brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 9647548 Raw
171 lines · plain
1; Test 64-bit atomic ANDs.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s4 5; Check ANDs of a variable.6define i64 @f1(i64 %dummy, ptr %src, i64 %b) {7; CHECK-LABEL: f1:8; CHECK: lg %r2, 0(%r3)9; CHECK: [[LABEL:\.[^:]*]]:10; CHECK: lgr %r0, %r211; CHECK: ngr %r0, %r412; CHECK: csg %r2, %r0, 0(%r3)13; CHECK: jl [[LABEL]]14; CHECK: br %r1415  %res = atomicrmw and ptr %src, i64 %b seq_cst16  ret i64 %res17}18 19; Check ANDs of 1, which are done using a register.20define i64 @f2(i64 %dummy, ptr %src) {21; CHECK-LABEL: f2:22; CHECK: risbg23; CHECK: br %r1424  %res = atomicrmw and ptr %src, i64 1 seq_cst25  ret i64 %res26}27 28; Check the equivalent of NIHF with 1, which can use RISBG instead.29define i64 @f3(i64 %dummy, ptr %src) {30; CHECK-LABEL: f3:31; CHECK: lg %r2, 0(%r3)32; CHECK: [[LABEL:\.[^:]*]]:33; CHECK: risbg %r0, %r2, 31, 191, 034; CHECK: csg %r2, %r0, 0(%r3)35; CHECK: jl [[LABEL]]36; CHECK: br %r1437  %res = atomicrmw and ptr %src, i64 8589934591 seq_cst38  ret i64 %res39}40 41; Check the lowest NIHF value outside the range of RISBG.42define i64 @f4(i64 %dummy, ptr %src) {43; CHECK-LABEL: f4:44; CHECK: lg %r2, 0(%r3)45; CHECK: [[LABEL:\.[^:]*]]:46; CHECK: lgr %r0, %r247; CHECK: nihf %r0, 248; CHECK: csg %r2, %r0, 0(%r3)49; CHECK: jl [[LABEL]]50; CHECK: br %r1451  %res = atomicrmw and ptr %src, i64 12884901887 seq_cst52  ret i64 %res53}54 55; Check the next value up, which must use a register.56define i64 @f5(i64 %dummy, ptr %src) {57; CHECK-LABEL: f5:58; CHECK: risbg59; CHECK: br %r1460  %res = atomicrmw and ptr %src, i64 12884901888 seq_cst61  ret i64 %res62}63 64; Check the lowest NIHH value outside the range of RISBG.65define i64 @f6(i64 %dummy, ptr %src) {66; CHECK-LABEL: f6:67; CHECK: nihh {{%r[0-5]}}, 268; CHECK: br %r1469  %res = atomicrmw and ptr %src, i64 844424930131967 seq_cst70  ret i64 %res71}72 73; Check the next value up, which must use a register.74define i64 @f7(i64 %dummy, ptr %src) {75; CHECK-LABEL: f7:76; CHECK: risbg77; CHECK: br %r1478  %res = atomicrmw and ptr %src, i64 281474976710656 seq_cst79  ret i64 %res80}81 82; Check the highest NILL value outside the range of RISBG.83define i64 @f8(i64 %dummy, ptr %src) {84; CHECK-LABEL: f8:85; CHECK: nill {{%r[0-5]}}, 6553086; CHECK: br %r1487  %res = atomicrmw and ptr %src, i64 -6 seq_cst88  ret i64 %res89}90 91; Check the lowest NILL value outside the range of RISBG.92define i64 @f9(i64 %dummy, ptr %src) {93; CHECK-LABEL: f9:94; CHECK: nill {{%r[0-5]}}, 295; CHECK: br %r1496  %res = atomicrmw and ptr %src, i64 -65534 seq_cst97  ret i64 %res98}99 100; Check the highest useful NILF value.101define i64 @f10(i64 %dummy, ptr %src) {102; CHECK-LABEL: f10:103; CHECK: nilf {{%r[0-5]}}, 4294901758104; CHECK: br %r14105  %res = atomicrmw and ptr %src, i64 -65538 seq_cst106  ret i64 %res107}108 109; Check the highest NILH value outside the range of RISBG.110define i64 @f11(i64 %dummy, ptr %src) {111; CHECK-LABEL: f11:112; CHECK: nilh {{%r[0-5]}}, 65530113; CHECK: br %r14114  %res = atomicrmw and ptr %src, i64 -327681 seq_cst115  ret i64 %res116}117 118; Check the lowest NILH value outside the range of RISBG.119define i64 @f12(i64 %dummy, ptr %src) {120; CHECK-LABEL: f12:121; CHECK: nilh {{%r[0-5]}}, 2122; CHECK: br %r14123  %res = atomicrmw and ptr %src, i64 -4294770689 seq_cst124  ret i64 %res125}126 127; Check the lowest NILF value outside the range of RISBG.128define i64 @f13(i64 %dummy, ptr %src) {129; CHECK-LABEL: f13:130; CHECK: nilf {{%r[0-5]}}, 2131; CHECK: br %r14132  %res = atomicrmw and ptr %src, i64 -4294967294 seq_cst133  ret i64 %res134}135 136; Check the highest NIHL value outside the range of RISBG.137define i64 @f14(i64 %dummy, ptr %src) {138; CHECK-LABEL: f14:139; CHECK: nihl {{%r[0-5]}}, 65530140; CHECK: br %r14141  %res = atomicrmw and ptr %src, i64 -21474836481 seq_cst142  ret i64 %res143}144 145; Check the lowest NIHL value outside the range of RISBG.146define i64 @f15(i64 %dummy, ptr %src) {147; CHECK-LABEL: f15:148; CHECK: nihl {{%r[0-5]}}, 2149; CHECK: br %r14150  %res = atomicrmw and ptr %src, i64 -281462091808769 seq_cst151  ret i64 %res152}153 154; Check the highest NIHH value outside the range of RISBG.155define i64 @f16(i64 %dummy, ptr %src) {156; CHECK-LABEL: f16:157; CHECK: nihh {{%r[0-5]}}, 65530158; CHECK: br %r14159  %res = atomicrmw and ptr %src, i64 -1407374883553281 seq_cst160  ret i64 %res161}162 163; Check the highest useful NIHF value.164define i64 @f17(i64 %dummy, ptr %src) {165; CHECK-LABEL: f17:166; CHECK: nihf {{%r[0-5]}}, 4294901758167; CHECK: br %r14168  %res = atomicrmw and ptr %src, i64 -281479271677953 seq_cst169  ret i64 %res170}171