brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 071fd0d Raw
141 lines · plain
1; Test 64-bit ANDs in which the second operand is variable.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s5 6declare i64 @foo()7 8; Check NGR.9define i64 @f1(i64 %a, i64 %b) {10; CHECK-LABEL: f1:11; CHECK: ngr %r2, %r312; CHECK: br %r1413  %and = and i64 %a, %b14  ret i64 %and15}16 17; Check NG with no displacement.18define i64 @f2(i64 %a, ptr %src) {19; CHECK-LABEL: f2:20; CHECK: ng %r2, 0(%r3)21; CHECK: br %r1422  %b = load i64, ptr %src23  %and = and i64 %a, %b24  ret i64 %and25}26 27; Check the high end of the aligned NG range.28define i64 @f3(i64 %a, ptr %src) {29; CHECK-LABEL: f3:30; CHECK: ng %r2, 524280(%r3)31; CHECK: br %r1432  %ptr = getelementptr i64, ptr %src, i64 6553533  %b = load i64, ptr %ptr34  %and = and i64 %a, %b35  ret i64 %and36}37 38; Check the next doubleword up, which needs separate address logic.39; Other sequences besides this one would be OK.40define i64 @f4(i64 %a, ptr %src) {41; CHECK-LABEL: f4:42; CHECK: agfi %r3, 52428843; CHECK: ng %r2, 0(%r3)44; CHECK: br %r1445  %ptr = getelementptr i64, ptr %src, i64 6553646  %b = load i64, ptr %ptr47  %and = and i64 %a, %b48  ret i64 %and49}50 51; Check the high end of the negative aligned NG range.52define i64 @f5(i64 %a, ptr %src) {53; CHECK-LABEL: f5:54; CHECK: ng %r2, -8(%r3)55; CHECK: br %r1456  %ptr = getelementptr i64, ptr %src, i64 -157  %b = load i64, ptr %ptr58  %and = and i64 %a, %b59  ret i64 %and60}61 62; Check the low end of the NG range.63define i64 @f6(i64 %a, ptr %src) {64; CHECK-LABEL: f6:65; CHECK: ng %r2, -524288(%r3)66; CHECK: br %r1467  %ptr = getelementptr i64, ptr %src, i64 -6553668  %b = load i64, ptr %ptr69  %and = and i64 %a, %b70  ret i64 %and71}72 73; Check the next doubleword down, which needs separate address logic.74; Other sequences besides this one would be OK.75define i64 @f7(i64 %a, ptr %src) {76; CHECK-LABEL: f7:77; CHECK: agfi %r3, -52429678; CHECK: ng %r2, 0(%r3)79; CHECK: br %r1480  %ptr = getelementptr i64, ptr %src, i64 -6553781  %b = load i64, ptr %ptr82  %and = and i64 %a, %b83  ret i64 %and84}85 86; Check that NG allows an index.87define i64 @f8(i64 %a, i64 %src, i64 %index) {88; CHECK-LABEL: f8:89; CHECK: ng %r2, 524280({{%r4,%r3|%r3,%r4}})90; CHECK: br %r1491  %add1 = add i64 %src, %index92  %add2 = add i64 %add1, 52428093  %ptr = inttoptr i64 %add2 to ptr94  %b = load i64, ptr %ptr95  %and = and i64 %a, %b96  ret i64 %and97}98 99; Check that ANDs of spilled values can use NG rather than NGR.100define i64 @f9(ptr %ptr0) {101; CHECK-LABEL: f9:102; CHECK: brasl %r14, foo@PLT103; CHECK: ng %r2, 160(%r15)104; CHECK: br %r14105  %ptr1 = getelementptr i64, ptr %ptr0, i64 2106  %ptr2 = getelementptr i64, ptr %ptr0, i64 4107  %ptr3 = getelementptr i64, ptr %ptr0, i64 6108  %ptr4 = getelementptr i64, ptr %ptr0, i64 8109  %ptr5 = getelementptr i64, ptr %ptr0, i64 10110  %ptr6 = getelementptr i64, ptr %ptr0, i64 12111  %ptr7 = getelementptr i64, ptr %ptr0, i64 14112  %ptr8 = getelementptr i64, ptr %ptr0, i64 16113  %ptr9 = getelementptr i64, ptr %ptr0, i64 18114 115  %val0 = load i64, ptr %ptr0116  %val1 = load i64, ptr %ptr1117  %val2 = load i64, ptr %ptr2118  %val3 = load i64, ptr %ptr3119  %val4 = load i64, ptr %ptr4120  %val5 = load i64, ptr %ptr5121  %val6 = load i64, ptr %ptr6122  %val7 = load i64, ptr %ptr7123  %val8 = load i64, ptr %ptr8124  %val9 = load i64, ptr %ptr9125 126  %ret = call i64 @foo()127 128  %and0 = and i64 %ret, %val0129  %and1 = and i64 %and0, %val1130  %and2 = and i64 %and1, %val2131  %and3 = and i64 %and2, %val3132  %and4 = and i64 %and3, %val4133  %and5 = and i64 %and4, %val5134  %and6 = and i64 %and5, %val6135  %and7 = and i64 %and6, %val7136  %and8 = and i64 %and7, %val8137  %and9 = and i64 %and8, %val9138 139  ret i64 %and9140}141