xref: /llvm-project/llvm/test/CodeGen/SystemZ/insert-04.ll (revision d24ab20e9b11d2076d8b9d5cd96f41a6b9c399fb)
19e3577ffSUlrich Weigand; Test insertions of 16-bit constants into an i64.
29e3577ffSUlrich Weigand;
39e3577ffSUlrich Weigand; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
49e3577ffSUlrich Weigand
59e3577ffSUlrich Weigand; Check the lowest useful IILL value.  (We use NILL rather than IILL
69e3577ffSUlrich Weigand; to clear 16 bits.)
79e3577ffSUlrich Weiganddefine i64 @f1(i64 %a) {
8*d24ab20eSStephen Lin; CHECK-LABEL: f1:
99e3577ffSUlrich Weigand; CHECK-NOT: ni
109e3577ffSUlrich Weigand; CHECK: iill %r2, 1
119e3577ffSUlrich Weigand; CHECK: br %r14
129e3577ffSUlrich Weigand  %and = and i64 %a, 18446744073709486080
139e3577ffSUlrich Weigand  %or = or i64 %and, 1
149e3577ffSUlrich Weigand  ret i64 %or
159e3577ffSUlrich Weigand}
169e3577ffSUlrich Weigand
179e3577ffSUlrich Weigand; Check a middle value.
189e3577ffSUlrich Weiganddefine i64 @f2(i64 %a) {
19*d24ab20eSStephen Lin; CHECK-LABEL: f2:
209e3577ffSUlrich Weigand; CHECK-NOT: ni
219e3577ffSUlrich Weigand; CHECK: iill %r2, 32769
229e3577ffSUlrich Weigand; CHECK: br %r14
239e3577ffSUlrich Weigand  %and = and i64 %a, -65536
249e3577ffSUlrich Weigand  %or = or i64 %and, 32769
259e3577ffSUlrich Weigand  ret i64 %or
269e3577ffSUlrich Weigand}
279e3577ffSUlrich Weigand
289e3577ffSUlrich Weigand; Check the highest useful IILL value.  (We use OILL rather than IILL
299e3577ffSUlrich Weigand; to set 16 bits.)
309e3577ffSUlrich Weiganddefine i64 @f3(i64 %a) {
31*d24ab20eSStephen Lin; CHECK-LABEL: f3:
329e3577ffSUlrich Weigand; CHECK-NOT: ni
339e3577ffSUlrich Weigand; CHECK: iill %r2, 65534
349e3577ffSUlrich Weigand; CHECK: br %r14
359e3577ffSUlrich Weigand  %and = and i64 %a, 18446744073709486080
369e3577ffSUlrich Weigand  %or = or i64 %and, 65534
379e3577ffSUlrich Weigand  ret i64 %or
389e3577ffSUlrich Weigand}
399e3577ffSUlrich Weigand
409e3577ffSUlrich Weigand; Check the lowest useful IILH value.
419e3577ffSUlrich Weiganddefine i64 @f4(i64 %a) {
42*d24ab20eSStephen Lin; CHECK-LABEL: f4:
439e3577ffSUlrich Weigand; CHECK-NOT: ni
449e3577ffSUlrich Weigand; CHECK: iilh %r2, 1
459e3577ffSUlrich Weigand; CHECK: br %r14
469e3577ffSUlrich Weigand  %and = and i64 %a, 18446744069414649855
479e3577ffSUlrich Weigand  %or = or i64 %and, 65536
489e3577ffSUlrich Weigand  ret i64 %or
499e3577ffSUlrich Weigand}
509e3577ffSUlrich Weigand
519e3577ffSUlrich Weigand; Check a middle value.
529e3577ffSUlrich Weiganddefine i64 @f5(i64 %a) {
53*d24ab20eSStephen Lin; CHECK-LABEL: f5:
549e3577ffSUlrich Weigand; CHECK-NOT: ni
559e3577ffSUlrich Weigand; CHECK: iilh %r2, 32767
569e3577ffSUlrich Weigand; CHECK: br %r14
579e3577ffSUlrich Weigand  %and = and i64 %a, -4294901761
589e3577ffSUlrich Weigand  %or = or i64 %and, 2147418112
599e3577ffSUlrich Weigand  ret i64 %or
609e3577ffSUlrich Weigand}
619e3577ffSUlrich Weigand
629e3577ffSUlrich Weigand; Check the highest useful IILH value.
639e3577ffSUlrich Weiganddefine i64 @f6(i64 %a) {
64*d24ab20eSStephen Lin; CHECK-LABEL: f6:
659e3577ffSUlrich Weigand; CHECK-NOT: ni
669e3577ffSUlrich Weigand; CHECK: iilh %r2, 65534
679e3577ffSUlrich Weigand; CHECK: br %r14
689e3577ffSUlrich Weigand  %and = and i64 %a, 18446744069414649855
699e3577ffSUlrich Weigand  %or = or i64 %and, 4294836224
709e3577ffSUlrich Weigand  ret i64 %or
719e3577ffSUlrich Weigand}
729e3577ffSUlrich Weigand
739e3577ffSUlrich Weigand; Check the lowest useful IIHL value.
749e3577ffSUlrich Weiganddefine i64 @f7(i64 %a) {
75*d24ab20eSStephen Lin; CHECK-LABEL: f7:
769e3577ffSUlrich Weigand; CHECK-NOT: ni
779e3577ffSUlrich Weigand; CHECK: iihl %r2, 1
789e3577ffSUlrich Weigand; CHECK: br %r14
799e3577ffSUlrich Weigand  %and = and i64 %a, 18446462603027808255
809e3577ffSUlrich Weigand  %or = or i64 %and, 4294967296
819e3577ffSUlrich Weigand  ret i64 %or
829e3577ffSUlrich Weigand}
839e3577ffSUlrich Weigand
849e3577ffSUlrich Weigand; Check a middle value.
859e3577ffSUlrich Weiganddefine i64 @f8(i64 %a) {
86*d24ab20eSStephen Lin; CHECK-LABEL: f8:
879e3577ffSUlrich Weigand; CHECK-NOT: ni
889e3577ffSUlrich Weigand; CHECK: iihl %r2, 32767
899e3577ffSUlrich Weigand; CHECK: br %r14
909e3577ffSUlrich Weigand  %and = and i64 %a, -281470681743361
919e3577ffSUlrich Weigand  %or = or i64 %and, 140733193388032
929e3577ffSUlrich Weigand  ret i64 %or
939e3577ffSUlrich Weigand}
949e3577ffSUlrich Weigand
959e3577ffSUlrich Weigand; Check the highest useful IIHL value.
969e3577ffSUlrich Weiganddefine i64 @f9(i64 %a) {
97*d24ab20eSStephen Lin; CHECK-LABEL: f9:
989e3577ffSUlrich Weigand; CHECK-NOT: ni
999e3577ffSUlrich Weigand; CHECK: iihl %r2, 65534
1009e3577ffSUlrich Weigand; CHECK: br %r14
1019e3577ffSUlrich Weigand  %and = and i64 %a, 18446462603027808255
1029e3577ffSUlrich Weigand  %or = or i64 %and, 281466386776064
1039e3577ffSUlrich Weigand  ret i64 %or
1049e3577ffSUlrich Weigand}
1059e3577ffSUlrich Weigand
1069e3577ffSUlrich Weigand; Check the lowest useful IIHH value.
1079e3577ffSUlrich Weiganddefine i64 @f10(i64 %a) {
108*d24ab20eSStephen Lin; CHECK-LABEL: f10:
1099e3577ffSUlrich Weigand; CHECK-NOT: ni
1109e3577ffSUlrich Weigand; CHECK: iihh %r2, 1
1119e3577ffSUlrich Weigand; CHECK: br %r14
1129e3577ffSUlrich Weigand  %and = and i64 %a, 281474976710655
1139e3577ffSUlrich Weigand  %or = or i64 %and, 281474976710656
1149e3577ffSUlrich Weigand  ret i64 %or
1159e3577ffSUlrich Weigand}
1169e3577ffSUlrich Weigand
1179e3577ffSUlrich Weigand; Check a middle value.
1189e3577ffSUlrich Weiganddefine i64 @f11(i64 %a) {
119*d24ab20eSStephen Lin; CHECK-LABEL: f11:
1209e3577ffSUlrich Weigand; CHECK-NOT: ni
1219e3577ffSUlrich Weigand; CHECK: iihh %r2, 32767
1229e3577ffSUlrich Weigand; CHECK: br %r14
1239e3577ffSUlrich Weigand  %and = and i64 %a, 281474976710655
1249e3577ffSUlrich Weigand  %or = or i64 %and, 9223090561878065152
1259e3577ffSUlrich Weigand  ret i64 %or
1269e3577ffSUlrich Weigand}
1279e3577ffSUlrich Weigand
1289e3577ffSUlrich Weigand; Check the highest useful IIHH value.
1299e3577ffSUlrich Weiganddefine i64 @f12(i64 %a) {
130*d24ab20eSStephen Lin; CHECK-LABEL: f12:
1319e3577ffSUlrich Weigand; CHECK-NOT: ni
1329e3577ffSUlrich Weigand; CHECK: iihh %r2, 65534
1339e3577ffSUlrich Weigand; CHECK: br %r14
1349e3577ffSUlrich Weigand  %and = and i64 %a, 281474976710655
1359e3577ffSUlrich Weigand  %or = or i64 %and, 18446181123756130304
1369e3577ffSUlrich Weigand  ret i64 %or
1379e3577ffSUlrich Weigand}
138