Skip to content

Commit d77dc1f

Browse files
committed
16bit for asm inline reg
1 parent cb57578 commit d77dc1f

File tree

3 files changed

+100
-1
lines changed

3 files changed

+100
-1
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16062,7 +16062,10 @@ SITargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI_,
1606216062
case 'v':
1606316063
switch (BitWidth) {
1606416064
case 16:
16065-
RC = &AMDGPU::VGPR_32RegClass;
16065+
if (Subtarget->useRealTrue16Insts())
16066+
RC = &AMDGPU::VGPR_16RegClass;
16067+
else
16068+
RC = &AMDGPU::VGPR_32RegClass;
1606616069
break;
1606716070
default:
1606816071
RC = TRI->getVGPRClassForBitWidth(BitWidth);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-real-true16 -verify-machineinstrs < %s 2>&1 | FileCheck -enable-var-scope -check-prefixes=GFX11 %s
2+
3+
; GFX11-LABEL: {{^}}s_input_output_i16:
4+
; GFX11: s_mov_b32 s[[REG:[0-9]+]], -1
5+
; GFX11: ; use s[[REG]]
6+
define amdgpu_kernel void @s_input_output_i16() #0 {
7+
%v = tail call i16 asm sideeffect "s_mov_b32 $0, -1", "=s"()
8+
tail call void asm sideeffect "; use $0", "s"(i16 %v) #0
9+
ret void
10+
}
11+
12+
; GFX11-LABEL: {{^}}s_input_output_f16:
13+
; GFX11: s_mov_b32 s[[REG:[0-9]+]], -1
14+
; GFX11: ; use s[[REG]]
15+
define amdgpu_kernel void @s_input_output_f16() #0 {
16+
%v = tail call half asm sideeffect "s_mov_b32 $0, -1", "=s"() #0
17+
tail call void asm sideeffect "; use $0", "s"(half %v)
18+
ret void
19+
}
20+
21+
; GFX11-LABEL: {{^}}v_input_output_f16:
22+
; GFX11: v_mov_b32 v[[REG:[0-9]+]], -1
23+
; GFX11: ; use v[[REG]]
24+
define amdgpu_kernel void @v_input_output_f16() #0 {
25+
%v = tail call half asm sideeffect "v_mov_b32 $0, -1", "=v"() #0
26+
tail call void asm sideeffect "; use $0", "v"(half %v)
27+
ret void
28+
}
29+
30+
; GFX11-LABEL: {{^}}v_input_output_i16:
31+
; GFX11: v_mov_b32 v[[REG:[0-9]+]], -1
32+
; GFX11: ; use v[[REG]]
33+
define amdgpu_kernel void @v_input_output_i16() #0 {
34+
%v = tail call i16 asm sideeffect "v_mov_b32 $0, -1", "=v"() #0
35+
tail call void asm sideeffect "; use $0", "v"(i16 %v)
36+
ret void
37+
}
38+
39+
; GFX11-LABEL: {{^}}i16_imm_input_phys_vgpr:
40+
; GFX11: v_mov_b32_e32 v0, 0xffff
41+
; GFX11: ; use v0
42+
define amdgpu_kernel void @i16_imm_input_phys_vgpr() {
43+
entry:
44+
call void asm sideeffect "; use $0 ", "{v0}"(i16 65535)
45+
ret void
46+
}
47+
48+
attributes #0 = { nounwind }
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=+real-true16 -verify-machineinstrs < %s 2>&1 | FileCheck -enable-var-scope -check-prefixes=GFX11 %s
2+
3+
; GFX11-LABEL: {{^}}s_input_output_i16:
4+
; GFX11: s_mov_b32 s[[REG:[0-9]+]], -1
5+
; GFX11: ; use s[[REG]]
6+
define amdgpu_kernel void @s_input_output_i16() #0 {
7+
%v = tail call i16 asm sideeffect "s_mov_b32 $0, -1", "=s"()
8+
tail call void asm sideeffect "; use $0", "s"(i16 %v) #0
9+
ret void
10+
}
11+
12+
; GFX11-LABEL: {{^}}s_input_output_f16:
13+
; GFX11: s_mov_b32 s[[REG:[0-9]+]], -1
14+
; GFX11: ; use s[[REG]]
15+
define amdgpu_kernel void @s_input_output_f16() #0 {
16+
%v = tail call half asm sideeffect "s_mov_b32 $0, -1", "=s"() #0
17+
tail call void asm sideeffect "; use $0", "s"(half %v)
18+
ret void
19+
}
20+
21+
; GFX11-LABEL: {{^}}v_input_output_f16:
22+
; GFX11: v_mov_b16 v[[REG:[0-9]+.(l|h)]], -1
23+
; GFX11: ; use v[[REG]]
24+
define amdgpu_kernel void @v_input_output_f16() #0 {
25+
%v = tail call half asm sideeffect "v_mov_b16 $0, -1", "=v"() #0
26+
tail call void asm sideeffect "; use $0", "v"(half %v)
27+
ret void
28+
}
29+
30+
; GFX11-LABEL: {{^}}v_input_output_i16:
31+
; GFX11: v_mov_b16 v[[REG:[0-9]+.(l|h)]], -1
32+
; GFX11: ; use v[[REG]]
33+
define amdgpu_kernel void @v_input_output_i16() #0 {
34+
%v = tail call i16 asm sideeffect "v_mov_b16 $0, -1", "=v"() #0
35+
tail call void asm sideeffect "; use $0", "v"(i16 %v)
36+
ret void
37+
}
38+
39+
; GFX11-LABEL: {{^}}i16_imm_input_phys_vgpr:
40+
; GFX11: v_mov_b16_e32 v0.l, -1
41+
; GFX11: ; use v0.l
42+
define amdgpu_kernel void @i16_imm_input_phys_vgpr() {
43+
entry:
44+
call void asm sideeffect "; use $0 ", "{v0.l}"(i16 65535)
45+
ret void
46+
}
47+
48+
attributes #0 = { nounwind }

0 commit comments

Comments
 (0)