Skip to content

Commit b1575e5

Browse files
add more test
1 parent c720140 commit b1575e5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

llvm/test/CodeGen/AMDGPU/uniform-vgpr-to-sgpr-return.ll

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,31 @@ define amdgpu_ps float @uniform_v_to_s_f32(float inreg %a, float inreg %b) {
145145
%max0 = call float @llvm.maximum.f32(float %a, float %b)
146146
ret float %max0
147147
}
148+
149+
define amdgpu_ps <2 x i16> @uniform_v_to_s_2_i16(float inreg %a, float inreg %b) {
150+
; GFX11-LABEL: uniform_v_to_s_2_i16:
151+
; GFX11: ; %bb.0:
152+
; GFX11-NEXT: v_max_f32_e64 v0, s0, s1
153+
; GFX11-NEXT: v_cmp_o_f32_e64 vcc_lo, s0, s1
154+
; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
155+
; GFX11-NEXT: v_cndmask_b32_e32 v0, 0x7fc00000, v0, vcc_lo
156+
; GFX11-NEXT: v_readfirstlane_b32 s0, v0
157+
; GFX11-NEXT: ; return to shader part epilog
158+
%max0 = call float @llvm.maximum.f32(float %a, float %b)
159+
%cast = bitcast float %max0 to <2 x i16>
160+
ret <2 x i16> %cast
161+
}
162+
163+
define amdgpu_ps i16 @uniform_v_to_s_i16(half inreg %a, half inreg %b) {
164+
; GFX11-LABEL: uniform_v_to_s_i16:
165+
; GFX11: ; %bb.0:
166+
; GFX11-NEXT: v_max_f16_e64 v0, s0, s1
167+
; GFX11-NEXT: v_cmp_o_f16_e64 vcc_lo, s0, s1
168+
; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
169+
; GFX11-NEXT: v_cndmask_b32_e32 v0, 0x7e00, v0, vcc_lo
170+
; GFX11-NEXT: v_readfirstlane_b32 s0, v0
171+
; GFX11-NEXT: ; return to shader part epilog
172+
%max = call half @llvm.maximum.f16(half %a, half %b)
173+
%cast = bitcast half %max to i16
174+
ret i16 %cast
175+
}

0 commit comments

Comments
 (0)