brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · efb21f3 Raw
184 lines · plain
1; Test 64-bit ANDs in which the second operand is constant.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5; Use RISBG for a single bit.6define i64 @f1(i64 %a) {7; CHECK-LABEL: f1:8; CHECK: risbg %r2, %r2, 63, 191, 09; CHECK: br %r1410  %and = and i64 %a, 111  ret i64 %and12}13 14; Likewise 0xfffe.15define i64 @f2(i64 %a) {16; CHECK-LABEL: f2:17; CHECK: risbg %r2, %r2, 48, 190, 018; CHECK: br %r1419  %and = and i64 %a, 6553420  ret i64 %and21}22 23; ...but 0xffff is a 16-bit zero extension.24define i64 @f3(i64 %a, i64 %b) {25; CHECK-LABEL: f3:26; CHECK: llghr %r2, %r327; CHECK: br %r1428  %and = and i64 %b, 6553529  ret i64 %and30}31 32; Check the next value up, which can again use RISBG.33define i64 @f4(i64 %a) {34; CHECK-LABEL: f4:35; CHECK: risbg %r2, %r2, 47, 175, 036; CHECK: br %r1437  %and = and i64 %a, 6553638  ret i64 %and39}40 41; Check 0xfffffffe, which can also use RISBG.42define i64 @f5(i64 %a) {43; CHECK-LABEL: f5:44; CHECK: risbg %r2, %r2, 32, 190, 045; CHECK: br %r1446  %and = and i64 %a, 429496729447  ret i64 %and48}49 50; Check the next value up, which is a 32-bit zero extension.51define i64 @f6(i64 %a, i64 %b) {52; CHECK-LABEL: f6:53; CHECK: llgfr %r2, %r354; CHECK: br %r1455  %and = and i64 %b, 429496729556  ret i64 %and57}58 59; Check the lowest useful NIHF value (0x00000001_ffffffff).60define i64 @f7(i64 %a) {61; CHECK-LABEL: f7:62; CHECK: nihf %r2, 163; CHECK: br %r1464  %and = and i64 %a, 858993459165  ret i64 %and66}67 68; ...but RISBG can be used if a three-address form is useful.69define i64 @f8(i64 %a, i64 %b) {70; CHECK-LABEL: f8:71; CHECK: risbg %r2, %r3, 31, 191, 072; CHECK: br %r1473  %and = and i64 %b, 858993459174  ret i64 %and75}76 77; Check the lowest NIHH value outside the RISBG range (0x0002ffff_ffffffff).78define i64 @f9(i64 %a) {79; CHECK-LABEL: f9:80; CHECK: nihh %r2, 281; CHECK: br %r1482  %and = and i64 %a, 84442493013196783  ret i64 %and84}85 86; Check the highest NIHH value outside the RISBG range (0xfffaffff_ffffffff).87define i64 @f10(i64 %a) {88; CHECK-LABEL: f10:89; CHECK: nihh %r2, 6553090; CHECK: br %r1491  %and = and i64 %a, -140737488355328192  ret i64 %and93}94 95; Check the highest useful NIHF value (0xfffefffe_ffffffff).96define i64 @f11(i64 %a) {97; CHECK-LABEL: f11:98; CHECK: nihf %r2, 429490175899; CHECK: br %r14100  %and = and i64 %a, -281479271677953101  ret i64 %and102}103 104; Check the lowest NIHL value outside the RISBG range (0xffff0002_ffffffff).105define i64 @f12(i64 %a) {106; CHECK-LABEL: f12:107; CHECK: nihl %r2, 2108; CHECK: br %r14109  %and = and i64 %a, -281462091808769110  ret i64 %and111}112 113; Check the highest NIHL value outside the RISBG range (0xfffffffa_ffffffff).114define i64 @f13(i64 %a) {115; CHECK-LABEL: f13:116; CHECK: nihl %r2, 65530117; CHECK: br %r14118  %and = and i64 %a, -21474836481119  ret i64 %and120}121 122; Check the lowest NILF value outside the RISBG range (0xffffffff_00000002).123define i64 @f14(i64 %a) {124; CHECK-LABEL: f14:125; CHECK: nilf %r2, 2126; CHECK: br %r14127  %and = and i64 %a, -4294967294128  ret i64 %and129}130 131; Check the lowest NILH value outside the RISBG range (0xffffffff_0002ffff).132define i64 @f15(i64 %a) {133; CHECK-LABEL: f15:134; CHECK: nilh %r2, 2135; CHECK: br %r14136  %and = and i64 %a, -4294770689137  ret i64 %and138}139 140; Check the next value up, which must use NILF.141define i64 @f16(i64 %a) {142; CHECK-LABEL: f16:143; CHECK: nilf %r2, 196608144; CHECK: br %r14145  %and = and i64 %a, -4294770688146  ret i64 %and147}148 149; Check the highest NILH value outside the RISBG range (0xffffffff_fffaffff).150define i64 @f17(i64 %a) {151; CHECK-LABEL: f17:152; CHECK: nilh %r2, 65530153; CHECK: br %r14154  %and = and i64 %a, -327681155  ret i64 %and156}157 158; Check the maximum useful NILF value (0xffffffff_fffefffe).159define i64 @f18(i64 %a) {160; CHECK-LABEL: f18:161; CHECK: nilf %r2, 4294901758162; CHECK: br %r14163  %and = and i64 %a, -65538164  ret i64 %and165}166 167; Check the lowest NILL value outside the RISBG range (0xffffffff_ffff0002).168define i64 @f19(i64 %a) {169; CHECK-LABEL: f19:170; CHECK: nill %r2, 2171; CHECK: br %r14172  %and = and i64 %a, -65534173  ret i64 %and174}175 176; Check the highest NILL value outside the RISBG range.177define i64 @f20(i64 %a) {178; CHECK-LABEL: f20:179; CHECK: nill %r2, 65530180; CHECK: br %r14181  %and = and i64 %a, -6182  ret i64 %and183}184