brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 1873419 Raw
89 lines · plain
1; Test 32-bit byteswaps from registers to memory.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5declare i32 @llvm.bswap.i32(i32 %a)6 7; Check STRV with no displacement.8define void @f1(ptr %dst, i32 %a) {9; CHECK-LABEL: f1:10; CHECK: strv %r3, 0(%r2)11; CHECK: br %r1412  %swapped = call i32 @llvm.bswap.i32(i32 %a)13  store i32 %swapped, ptr %dst14  ret void15}16 17; Check the high end of the aligned STRV range.18define void @f2(ptr %dst, i32 %a) {19; CHECK-LABEL: f2:20; CHECK: strv %r3, 524284(%r2)21; CHECK: br %r1422  %ptr = getelementptr i32, ptr %dst, i64 13107123  %swapped = call i32 @llvm.bswap.i32(i32 %a)24  store i32 %swapped, ptr %ptr25  ret void26}27 28; Check the next word up, which needs separate address logic.29; Other sequences besides this one would be OK.30define void @f3(ptr %dst, i32 %a) {31; CHECK-LABEL: f3:32; CHECK: agfi %r2, 52428833; CHECK: strv %r3, 0(%r2)34; CHECK: br %r1435  %ptr = getelementptr i32, ptr %dst, i64 13107236  %swapped = call i32 @llvm.bswap.i32(i32 %a)37  store i32 %swapped, ptr %ptr38  ret void39}40 41; Check the high end of the negative aligned STRV range.42define void @f4(ptr %dst, i32 %a) {43; CHECK-LABEL: f4:44; CHECK: strv %r3, -4(%r2)45; CHECK: br %r1446  %ptr = getelementptr i32, ptr %dst, i64 -147  %swapped = call i32 @llvm.bswap.i32(i32 %a)48  store i32 %swapped, ptr %ptr49  ret void50}51 52; Check the low end of the STRV range.53define void @f5(ptr %dst, i32 %a) {54; CHECK-LABEL: f5:55; CHECK: strv %r3, -524288(%r2)56; CHECK: br %r1457  %ptr = getelementptr i32, ptr %dst, i64 -13107258  %swapped = call i32 @llvm.bswap.i32(i32 %a)59  store i32 %swapped, ptr %ptr60  ret void61}62 63; Check the next word down, which needs separate address logic.64; Other sequences besides this one would be OK.65define void @f6(ptr %dst, i32 %a) {66; CHECK-LABEL: f6:67; CHECK: agfi %r2, -52429268; CHECK: strv %r3, 0(%r2)69; CHECK: br %r1470  %ptr = getelementptr i32, ptr %dst, i64 -13107371  %swapped = call i32 @llvm.bswap.i32(i32 %a)72  store i32 %swapped, ptr %ptr73  ret void74}75 76; Check that STRV allows an index.77define void @f7(i64 %src, i64 %index, i32 %a) {78; CHECK-LABEL: f7:79; CHECK: strv %r4, 524287({{%r3,%r2|%r2,%r3}})80; CHECK: br %r1481  %add1 = add i64 %src, %index82  %add2 = add i64 %add1, 52428783  %ptr = inttoptr i64 %add2 to ptr84  %swapped = call i32 @llvm.bswap.i32(i32 %a)85  store i32 %swapped, ptr %ptr86  ret void87}88 89