llvm.org GIT mirror llvm / 6dae7ae
[SystemZ] Add tests for ALHSIK and ALGHSIK The insn definitions themselves crept into r186689, sorry. This should be the last of the distinct-ops instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186690 91177308-0d34-0410-b5e6-96231b3b80d8 Richard Sandiford 6 years ago
4 changed file(s) with 147 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1919 %low = extractelement <2 x i64> %addv, i32 1
2020 ret i64 %low
2121 }
22
23 ; Test addition of 1.
24 define void @f2(i64 %a, i64 %b, i128 *%ptr) {
25 ; CHECK-LABEL: f2:
26 ; CHECK: alghsik {{%r[0-5]}}, %r3, 1
27 ; CHECK: alcgr
28 ; CHECK: br %r14
29 %x1 = insertelement <2 x i64> undef, i64 %a, i32 0
30 %x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
31 %x = bitcast <2 x i64> %x2 to i128
32 %add = add i128 %x, 1
33 store i128 %add, i128 *%ptr
34 ret void
35 }
36
37 ; Test the upper end of the ALGHSIK range.
38 define void @f3(i64 %a, i64 %b, i128 *%ptr) {
39 ; CHECK-LABEL: f3:
40 ; CHECK: alghsik {{%r[0-5]}}, %r3, 32767
41 ; CHECK: alcgr
42 ; CHECK: br %r14
43 %x1 = insertelement <2 x i64> undef, i64 %a, i32 0
44 %x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
45 %x = bitcast <2 x i64> %x2 to i128
46 %add = add i128 %x, 32767
47 store i128 %add, i128 *%ptr
48 ret void
49 }
50
51 ; Test the next value up, which should use ALGFI instead.
52 define void @f4(i64 %a, i64 %b, i128 *%ptr) {
53 ; CHECK-LABEL: f4:
54 ; CHECK: algfi %r3, 32768
55 ; CHECK: alcgr
56 ; CHECK: br %r14
57 %x1 = insertelement <2 x i64> undef, i64 %a, i32 0
58 %x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
59 %x = bitcast <2 x i64> %x2 to i128
60 %add = add i128 %x, 32768
61 store i128 %add, i128 *%ptr
62 ret void
63 }
64
65 ; Test the lower end of the ALGHSIK range.
66 define void @f5(i64 %a, i64 %b, i128 *%ptr) {
67 ; CHECK-LABEL: f5:
68 ; CHECK: alghsik {{%r[0-5]}}, %r3, -32768
69 ; CHECK: alcgr
70 ; CHECK: br %r14
71 %x1 = insertelement <2 x i64> undef, i64 %a, i32 0
72 %x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
73 %x = bitcast <2 x i64> %x2 to i128
74 %add = add i128 %x, -32768
75 store i128 %add, i128 *%ptr
76 ret void
77 }
78
79 ; Test the next value down, which cannot use either ALGHSIK or ALGFI.
80 define void @f6(i64 %a, i64 %b, i128 *%ptr) {
81 ; CHECK-LABEL: f6:
82 ; CHECK-NOT: alghsik
83 ; CHECK-NOT: algfi
84 ; CHECK: alcgr
85 ; CHECK: br %r14
86 %x1 = insertelement <2 x i64> undef, i64 %a, i32 0
87 %x2 = insertelement <2 x i64> %x1, i64 %b, i32 1
88 %x = bitcast <2 x i64> %x2 to i128
89 %add = add i128 %x, -32769
90 store i128 %add, i128 *%ptr
91 ret void
92 }
540540 # CHECK: alg %r15, 0
541541 0xe3 0xf0 0x00 0x00 0x00 0x0a
542542
543 # CHECK: alghsik %r0, %r1, -32768
544 0xec 0x01 0x80 0x00 0x00 0xdb
545
546 # CHECK: alghsik %r2, %r3, -1
547 0xec 0x23 0xff 0xff 0x00 0xdb
548
549 # CHECK: alghsik %r4, %r5, 0
550 0xec 0x45 0x00 0x00 0x00 0xdb
551
552 # CHECK: alghsik %r6, %r7, 1
553 0xec 0x67 0x00 0x01 0x00 0xdb
554
555 # CHECK: alghsik %r8, %r15, 32767
556 0xec 0x8f 0x7f 0xff 0x00 0xdb
557
558 # CHECK: alhsik %r0, %r1, -32768
559 0xec 0x01 0x80 0x00 0x00 0xda
560
561 # CHECK: alhsik %r2, %r3, -1
562 0xec 0x23 0xff 0xff 0x00 0xda
563
564 # CHECK: alhsik %r4, %r5, 0
565 0xec 0x45 0x00 0x00 0x00 0xda
566
567 # CHECK: alhsik %r6, %r7, 1
568 0xec 0x67 0x00 0x01 0x00 0xda
569
570 # CHECK: alhsik %r8, %r15, 32767
571 0xec 0x8f 0x7f 0xff 0x00 0xda
572
543573 # CHECK: alr %r0, %r0
544574 0x1e 0x00
545575
158158
159159 alfi %r0, -1
160160 alfi %r0, (1 << 32)
161
162 #CHECK: error: {{(instruction requires: distinct-ops)?}}
163 #CHECK: alghsik %r1, %r2, 3
164
165 alghsik %r1, %r2, 3
166
167 #CHECK: error: {{(instruction requires: distinct-ops)?}}
168 #CHECK: alhsik %r1, %r2, 3
169
170 alhsik %r1, %r2, 3
161171
162172 #CHECK: error: invalid operand
163173 #CHECK: alg %r0, -524289
4848 ahik %r15, %r0, 0
4949 ahik %r7, %r8, -16
5050
51 #CHECK: alghsik %r0, %r0, -32768 # encoding: [0xec,0x00,0x80,0x00,0x00,0xdb]
52 #CHECK: alghsik %r0, %r0, -1 # encoding: [0xec,0x00,0xff,0xff,0x00,0xdb]
53 #CHECK: alghsik %r0, %r0, 0 # encoding: [0xec,0x00,0x00,0x00,0x00,0xdb]
54 #CHECK: alghsik %r0, %r0, 1 # encoding: [0xec,0x00,0x00,0x01,0x00,0xdb]
55 #CHECK: alghsik %r0, %r0, 32767 # encoding: [0xec,0x00,0x7f,0xff,0x00,0xdb]
56 #CHECK: alghsik %r0, %r15, 0 # encoding: [0xec,0x0f,0x00,0x00,0x00,0xdb]
57 #CHECK: alghsik %r15, %r0, 0 # encoding: [0xec,0xf0,0x00,0x00,0x00,0xdb]
58 #CHECK: alghsik %r7, %r8, -16 # encoding: [0xec,0x78,0xff,0xf0,0x00,0xdb]
59
60 alghsik %r0, %r0, -32768
61 alghsik %r0, %r0, -1
62 alghsik %r0, %r0, 0
63 alghsik %r0, %r0, 1
64 alghsik %r0, %r0, 32767
65 alghsik %r0, %r15, 0
66 alghsik %r15, %r0, 0
67 alghsik %r7, %r8, -16
68
5169 #CHECK: algrk %r0, %r0, %r0 # encoding: [0xb9,0xea,0x00,0x00]
5270 #CHECK: algrk %r0, %r0, %r15 # encoding: [0xb9,0xea,0xf0,0x00]
5371 #CHECK: algrk %r0, %r15, %r0 # encoding: [0xb9,0xea,0x00,0x0f]
5977 algrk %r0,%r15,%r0
6078 algrk %r15,%r0,%r0
6179 algrk %r7,%r8,%r9
80
81 #CHECK: alhsik %r0, %r0, -32768 # encoding: [0xec,0x00,0x80,0x00,0x00,0xda]
82 #CHECK: alhsik %r0, %r0, -1 # encoding: [0xec,0x00,0xff,0xff,0x00,0xda]
83 #CHECK: alhsik %r0, %r0, 0 # encoding: [0xec,0x00,0x00,0x00,0x00,0xda]
84 #CHECK: alhsik %r0, %r0, 1 # encoding: [0xec,0x00,0x00,0x01,0x00,0xda]
85 #CHECK: alhsik %r0, %r0, 32767 # encoding: [0xec,0x00,0x7f,0xff,0x00,0xda]
86 #CHECK: alhsik %r0, %r15, 0 # encoding: [0xec,0x0f,0x00,0x00,0x00,0xda]
87 #CHECK: alhsik %r15, %r0, 0 # encoding: [0xec,0xf0,0x00,0x00,0x00,0xda]
88 #CHECK: alhsik %r7, %r8, -16 # encoding: [0xec,0x78,0xff,0xf0,0x00,0xda]
89
90 alhsik %r0, %r0, -32768
91 alhsik %r0, %r0, -1
92 alhsik %r0, %r0, 0
93 alhsik %r0, %r0, 1
94 alhsik %r0, %r0, 32767
95 alhsik %r0, %r15, 0
96 alhsik %r15, %r0, 0
97 alhsik %r7, %r8, -16
6298
6399 #CHECK: alrk %r0, %r0, %r0 # encoding: [0xb9,0xfa,0x00,0x00]
64100 #CHECK: alrk %r0, %r0, %r15 # encoding: [0xb9,0xfa,0xf0,0x00]