1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -stop-after=finalize-isel -o - %s | FileCheck -check-prefix=GFX908 %s
3; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -stop-after=finalize-isel -o - %s | FileCheck -check-prefix=GFX90A %s
4
5; Make sure we only use one 128-bit register instead of 2 for i128 asm
6; constraints
7
8define amdgpu_kernel void @s_input_output_i128() {
9  ; GFX908-LABEL: name: s_input_output_i128
10  ; GFX908: bb.0 (%ir-block.0):
11  ; GFX908:   INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 5111818 /* regdef:SGPR_128 */, def %4
12  ; GFX908:   [[COPY:%[0-9]+]]:sgpr_128 = COPY %4
13  ; GFX908:   INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 5111817 /* reguse:SGPR_128 */, [[COPY]]
14  ; GFX908:   S_ENDPGM 0
15  ; GFX90A-LABEL: name: s_input_output_i128
16  ; GFX90A: bb.0 (%ir-block.0):
17  ; GFX90A:   INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 5111818 /* regdef:SGPR_128 */, def %4
18  ; GFX90A:   [[COPY:%[0-9]+]]:sgpr_128 = COPY %4
19  ; GFX90A:   INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 5111817 /* reguse:SGPR_128 */, [[COPY]]
20  ; GFX90A:   S_ENDPGM 0
21  %val = tail call i128 asm sideeffect "; def $0", "=s"()
22  call void asm sideeffect "; use $0", "s"(i128 %val)
23  ret void
24}
25
26define amdgpu_kernel void @v_input_output_i128() {
27  ; GFX908-LABEL: name: v_input_output_i128
28  ; GFX908: bb.0 (%ir-block.0):
29  ; GFX908:   INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 4718602 /* regdef:VReg_128 */, def %4
30  ; GFX908:   [[COPY:%[0-9]+]]:vreg_128 = COPY %4
31  ; GFX908:   INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 4718601 /* reguse:VReg_128 */, [[COPY]]
32  ; GFX908:   S_ENDPGM 0
33  ; GFX90A-LABEL: name: v_input_output_i128
34  ; GFX90A: bb.0 (%ir-block.0):
35  ; GFX90A:   INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 4849674 /* regdef:VReg_128_Align2 */, def %4
36  ; GFX90A:   [[COPY:%[0-9]+]]:vreg_128_align2 = COPY %4
37  ; GFX90A:   INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 4849673 /* reguse:VReg_128_Align2 */, [[COPY]]
38  ; GFX90A:   S_ENDPGM 0
39  %val = tail call i128 asm sideeffect "; def $0", "=v"()
40  call void asm sideeffect "; use $0", "v"(i128 %val)
41  ret void
42}
43
44define amdgpu_kernel void @a_input_output_i128() {
45  ; GFX908-LABEL: name: a_input_output_i128
46  ; GFX908: bb.0 (%ir-block.0):
47  ; GFX908:   INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 4653066 /* regdef:AReg_128 */, def %4
48  ; GFX908:   [[COPY:%[0-9]+]]:areg_128 = COPY %4
49  ; GFX908:   INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 4653065 /* reguse:AReg_128 */, [[COPY]]
50  ; GFX908:   S_ENDPGM 0
51  ; GFX90A-LABEL: name: a_input_output_i128
52  ; GFX90A: bb.0 (%ir-block.0):
53  ; GFX90A:   INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 4784138 /* regdef:AReg_128_Align2 */, def %4
54  ; GFX90A:   [[COPY:%[0-9]+]]:areg_128_align2 = COPY %4
55  ; GFX90A:   INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 4784137 /* reguse:AReg_128_Align2 */, [[COPY]]
56  ; GFX90A:   S_ENDPGM 0
57  %val = call i128 asm sideeffect "; def $0", "=a"()
58  call void asm sideeffect "; use $0", "a"(i128 %val)
59  ret void
60}
61