llvm.org GIT mirror llvm / c7c7e15
[SystemZ] Add ALRK, AGLRK, SLRK and SGLRK Follows the same lines as r186686, but much more limited, since we only use ADD LOGICAL for multi-i64 additions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186689 91177308-0d34-0410-b5e6-96231b3b80d8 Richard Sandiford 6 years ago
9 changed file(s) with 152 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
563563 let Defs = [CC] in {
564564 // Addition of a register.
565565 let isCommutable = 1 in {
566 def ALR : BinaryRR <"al", 0x1E, addc, GR32, GR32>;
567 def ALGR : BinaryRRE<"alg", 0xB90A, addc, GR64, GR64>;
566 defm ALR : BinaryRRAndK<"al", 0x1E, 0xB9FA, addc, GR32, GR32>;
567 defm ALGR : BinaryRREAndK<"alg", 0xB90A, 0xB9EA, addc, GR64, GR64>;
568568 }
569569 def ALGFR : BinaryRRE<"algf", 0xB91A, null_frag, GR64, GR32>;
570
571 // Addition of signed 16-bit immediates.
572 def ALHSIK : BinaryRIE<"alhsik", 0xECDA, addc, GR32, imm32sx16>,
573 Requires<[FeatureDistinctOps]>;
574 def ALGHSIK : BinaryRIE<"alghsik", 0xECDB, addc, GR64, imm64sx16>,
575 Requires<[FeatureDistinctOps]>;
570576
571577 // Addition of unsigned 32-bit immediates.
572578 def ALFI : BinaryRIL<"alfi", 0xC2B, addc, GR32, uimm32>;
613619 // Subtraction producing a carry.
614620 let Defs = [CC] in {
615621 // Subtraction of a register.
616 def SLR : BinaryRR <"sl", 0x1F, subc, GR32, GR32>;
622 defm SLR : BinaryRRAndK<"sl", 0x1F, 0xB9FB, subc, GR32, GR32>;
617623 def SLGFR : BinaryRRE<"slgf", 0xB91B, null_frag, GR64, GR32>;
618 def SLGR : BinaryRRE<"slg", 0xB90B, subc, GR64, GR64>;
624 defm SLGR : BinaryRREAndK<"slg", 0xB90B, 0xB9EB, subc, GR64, GR64>;
619625
620626 // Subtraction of unsigned 32-bit immediates. These don't match
621627 // subc because we prefer addc for constants.
0 ; Test 128-bit addition in which the second operand is variable.
11 ;
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
34
45 declare i128 *@foo()
56
0 ; Test 128-bit addition in which the second operand is constant.
11 ;
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
33
44 ; Check additions of 1. The XOR ensures that we don't instead load the
55 ; constant into a register and use memory addition.
0 ; Test 128-bit addition when the distinct-operands facility is available.
1 ;
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
3
4 ; Test the case where both operands are in registers.
5 define i64 @f1(i64 %a, i64 %b, i64 %c, i64 %d, i64 *%ptr) {
6 ; CHECK-LABEL: f1:
7 ; CHECK: algrk %r2, %r4, %r5
8 ; CHECK: alcgr
9 ; CHECK: br %r14
10 %x1 = insertelement <2 x i64> undef, i64 %b, i32 0
11 %x2 = insertelement <2 x i64> %x1, i64 %c, i32 1
12 %x = bitcast <2 x i64> %x2 to i128
13 %y2 = insertelement <2 x i64> %x1, i64 %d, i32 1
14 %y = bitcast <2 x i64> %y2 to i128
15 %add = add i128 %x, %y
16 %addv = bitcast i128 %add to <2 x i64>
17 %high = extractelement <2 x i64> %addv, i32 0
18 store i64 %high, i64 *%ptr
19 %low = extractelement <2 x i64> %addv, i32 1
20 ret i64 %low
21 }
None ; Test 128-bit addition in which the second operand is variable.
0 ; Test 128-bit subtraction in which the second operand is variable.
11 ;
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
34
45 declare i128 *@foo()
56
0 ; Test 128-bit subtraction when the distinct-operands facility is available.
1 ;
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
3
4 ; Test the case where both operands are in registers.
5 define i64 @f1(i64 %a, i64 %b, i64 %c, i64 %d, i64 *%ptr) {
6 ; CHECK-LABEL: f1:
7 ; CHECK: slgrk %r2, %r4, %r5
8 ; CHECK: slbgr
9 ; CHECK: br %r14
10 %x1 = insertelement <2 x i64> undef, i64 %b, i32 0
11 %x2 = insertelement <2 x i64> %x1, i64 %c, i32 1
12 %x = bitcast <2 x i64> %x2 to i128
13 %y2 = insertelement <2 x i64> %x1, i64 %d, i32 1
14 %y = bitcast <2 x i64> %y2 to i128
15 %sub = sub i128 %x, %y
16 %subv = bitcast i128 %sub to <2 x i64>
17 %high = extractelement <2 x i64> %subv, i32 0
18 store i64 %high, i64 *%ptr
19 %low = extractelement <2 x i64> %subv, i32 1
20 ret i64 %low
21 }
504504 # CHECK: algr %r7, %r8
505505 0xb9 0x0a 0x00 0x78
506506
507 # CHECK: algrk %r0, %r0, %r0
508 0xb9 0xea 0x00 0x00
509
510 # CHECK: algrk %r2, %r3, %r4
511 0xb9 0xea 0x40 0x23
512
507513 # CHECK: alg %r0, -524288
508514 0xe3 0x00 0x00 0x00 0x80 0x0a
509515
546552 # CHECK: alr %r7, %r8
547553 0x1e 0x78
548554
555 # CHECK: alrk %r0, %r0, %r0
556 0xb9 0xfa 0x00 0x00
557
558 # CHECK: alrk %r2, %r3, %r4
559 0xb9 0xfa 0x40 0x23
560
549561 # CHECK: al %r0, 0
550562 0x5e 0x00 0x00 0x00
551563
52205232 # CHECK: slgr %r7, %r8
52215233 0xb9 0x0b 0x00 0x78
52225234
5235 # CHECK: slgrk %r0, %r0, %r0
5236 0xb9 0xeb 0x00 0x00
5237
5238 # CHECK: slgrk %r2, %r3, %r4
5239 0xb9 0xeb 0x40 0x23
5240
52235241 # CHECK: slg %r0, -524288
52245242 0xe3 0x00 0x00 0x00 0x80 0x0b
52255243
53585376 # CHECK: slr %r7, %r8
53595377 0x1f 0x78
53605378
5379 # CHECK: slrk %r0, %r0, %r0
5380 0xb9 0xfb 0x00 0x00
5381
5382 # CHECK: slrk %r2, %r3, %r4
5383 0xb9 0xfb 0x40 0x23
5384
53615385 # CHECK: sl %r0, 0
53625386 0x5f 0x00 0x00 0x00
53635387
182182
183183 algfi %r0, -1
184184 algfi %r0, (1 << 32)
185
186 #CHECK: error: {{(instruction requires: distinct-ops)?}}
187 #CHECK: algrk %r2,%r3,%r4
188
189 algrk %r2,%r3,%r4
190
191 #CHECK: error: {{(instruction requires: distinct-ops)?}}
192 #CHECK: alrk %r2,%r3,%r4
193
194 alrk %r2,%r3,%r4
185195
186196 #CHECK: error: invalid operand
187197 #CHECK: aly %r0, -524289
23602370 slgfi %r0, -1
23612371 slgfi %r0, (1 << 32)
23622372
2373 #CHECK: error: {{(instruction requires: distinct-ops)?}}
2374 #CHECK: slgrk %r2,%r3,%r4
2375
2376 slgrk %r2,%r3,%r4
2377
23632378 #CHECK: error: invalid operand
23642379 #CHECK: sll %r0,-1
23652380 #CHECK: error: invalid operand
23922407 #CHECK: sllk %r2,%r3,4(%r5)
23932408
23942409 sllk %r2,%r3,4(%r5)
2410
2411 #CHECK: error: {{(instruction requires: distinct-ops)?}}
2412 #CHECK: slrk %r2,%r3,%r4
2413
2414 slrk %r2,%r3,%r4
23952415
23962416 #CHECK: error: invalid operand
23972417 #CHECK: sly %r0, -524289
4848 ahik %r15, %r0, 0
4949 ahik %r7, %r8, -16
5050
51 #CHECK: algrk %r0, %r0, %r0 # encoding: [0xb9,0xea,0x00,0x00]
52 #CHECK: algrk %r0, %r0, %r15 # encoding: [0xb9,0xea,0xf0,0x00]
53 #CHECK: algrk %r0, %r15, %r0 # encoding: [0xb9,0xea,0x00,0x0f]
54 #CHECK: algrk %r15, %r0, %r0 # encoding: [0xb9,0xea,0x00,0xf0]
55 #CHECK: algrk %r7, %r8, %r9 # encoding: [0xb9,0xea,0x90,0x78]
56
57 algrk %r0,%r0,%r0
58 algrk %r0,%r0,%r15
59 algrk %r0,%r15,%r0
60 algrk %r15,%r0,%r0
61 algrk %r7,%r8,%r9
62
63 #CHECK: alrk %r0, %r0, %r0 # encoding: [0xb9,0xfa,0x00,0x00]
64 #CHECK: alrk %r0, %r0, %r15 # encoding: [0xb9,0xfa,0xf0,0x00]
65 #CHECK: alrk %r0, %r15, %r0 # encoding: [0xb9,0xfa,0x00,0x0f]
66 #CHECK: alrk %r15, %r0, %r0 # encoding: [0xb9,0xfa,0x00,0xf0]
67 #CHECK: alrk %r7, %r8, %r9 # encoding: [0xb9,0xfa,0x90,0x78]
68
69 alrk %r0,%r0,%r0
70 alrk %r0,%r0,%r15
71 alrk %r0,%r15,%r0
72 alrk %r15,%r0,%r0
73 alrk %r7,%r8,%r9
74
5175 #CHECK: ark %r0, %r0, %r0 # encoding: [0xb9,0xf8,0x00,0x00]
5276 #CHECK: ark %r0, %r0, %r15 # encoding: [0xb9,0xf8,0xf0,0x00]
5377 #CHECK: ark %r0, %r15, %r0 # encoding: [0xb9,0xf8,0x00,0x0f]
119143 sgrk %r0,%r15,%r0
120144 sgrk %r15,%r0,%r0
121145 sgrk %r7,%r8,%r9
146
147 #CHECK: slgrk %r0, %r0, %r0 # encoding: [0xb9,0xeb,0x00,0x00]
148 #CHECK: slgrk %r0, %r0, %r15 # encoding: [0xb9,0xeb,0xf0,0x00]
149 #CHECK: slgrk %r0, %r15, %r0 # encoding: [0xb9,0xeb,0x00,0x0f]
150 #CHECK: slgrk %r15, %r0, %r0 # encoding: [0xb9,0xeb,0x00,0xf0]
151 #CHECK: slgrk %r7, %r8, %r9 # encoding: [0xb9,0xeb,0x90,0x78]
152
153 slgrk %r0,%r0,%r0
154 slgrk %r0,%r0,%r15
155 slgrk %r0,%r15,%r0
156 slgrk %r15,%r0,%r0
157 slgrk %r7,%r8,%r9
158
159 #CHECK: slrk %r0, %r0, %r0 # encoding: [0xb9,0xfb,0x00,0x00]
160 #CHECK: slrk %r0, %r0, %r15 # encoding: [0xb9,0xfb,0xf0,0x00]
161 #CHECK: slrk %r0, %r15, %r0 # encoding: [0xb9,0xfb,0x00,0x0f]
162 #CHECK: slrk %r15, %r0, %r0 # encoding: [0xb9,0xfb,0x00,0xf0]
163 #CHECK: slrk %r7, %r8, %r9 # encoding: [0xb9,0xfb,0x90,0x78]
164
165 slrk %r0,%r0,%r0
166 slrk %r0,%r0,%r15
167 slrk %r0,%r15,%r0
168 slrk %r15,%r0,%r0
169 slrk %r7,%r8,%r9
122170
123171 #CHECK: sllk %r0, %r0, 0 # encoding: [0xeb,0x00,0x00,0x00,0x00,0xdf]
124172 #CHECK: sllk %r15, %r1, 0 # encoding: [0xeb,0xf1,0x00,0x00,0x00,0xdf]