1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx950 -o - %s | FileCheck -check-prefix=GFX950 %s
; RUN: llc -global-isel=1 -global-isel-abort=2 -mtriple=amdgcn -mcpu=gfx950 -o - %s | FileCheck -check-prefix=GFX950 %s
declare <2 x half> @llvm.amdgcn.cvt.sr.f16.f32(<2 x half>, float, i32, i1)
declare <2 x bfloat> @llvm.amdgcn.cvt.sr.bf16.f32(<2 x bfloat>, float, i32, i1)
define amdgpu_ps void @test_cvt_sr_bf16_f32_word_sel_0(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_bf16_f32_word_sel_0:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_bf16_f32 v4, v2, v3
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x bfloat>, ptr addrspace(1) %out, align 4
%cvt = tail call <2 x bfloat> @llvm.amdgcn.cvt.sr.bf16.f32(<2 x bfloat> %old, float %src0, i32 %src1, i1 false)
store <2 x bfloat> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_bf16_f32_word_sel_1(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_bf16_f32_word_sel_1:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_bf16_f32 v4, v2, v3 op_sel:[0,0,1]
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x bfloat>, ptr addrspace(1) %out, align 4
%cvt = tail call <2 x bfloat> @llvm.amdgcn.cvt.sr.bf16.f32(<2 x bfloat> %old, float %src0, i32 %src1, i1 true)
store <2 x bfloat> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_bf16_f32_fabs(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_bf16_f32_fabs:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: v_and_b32_e32 v2, 0x7fffffff, v2
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_bf16_f32 v4, v2, v3
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x bfloat>, ptr addrspace(1) %out, align 4
%src0.fabs = call float @llvm.fabs.f32(float %src0)
%cvt = tail call <2 x bfloat> @llvm.amdgcn.cvt.sr.bf16.f32(<2 x bfloat> %old, float %src0.fabs, i32 %src1, i1 false)
store <2 x bfloat> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_bf16_f32_fneg(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_bf16_f32_fneg:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: v_xor_b32_e32 v2, 0x80000000, v2
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_bf16_f32 v4, v2, v3
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x bfloat>, ptr addrspace(1) %out, align 4
%src0.fneg = fneg float %src0
%cvt = tail call <2 x bfloat> @llvm.amdgcn.cvt.sr.bf16.f32(<2 x bfloat> %old, float %src0.fneg, i32 %src1, i1 false)
store <2 x bfloat> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_f16_f32_word_sel_0(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_f16_f32_word_sel_0:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_f16_f32 v4, v2, v3
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x half>, ptr addrspace(1) %out, align 4
%cvt = tail call <2 x half> @llvm.amdgcn.cvt.sr.f16.f32(<2 x half> %old, float %src0, i32 %src1, i1 false)
store <2 x half> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_f16_f32_word_sel_1(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_f16_f32_word_sel_1:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_f16_f32 v4, v2, v3 op_sel:[0,0,1]
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x half>, ptr addrspace(1) %out, align 4
%cvt = tail call <2 x half> @llvm.amdgcn.cvt.sr.f16.f32(<2 x half> %old, float %src0, i32 %src1, i1 true)
store <2 x half> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_f16_f32_fabs(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_f16_f32_fabs:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: v_and_b32_e32 v2, 0x7fffffff, v2
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_f16_f32 v4, v2, v3
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x half>, ptr addrspace(1) %out, align 4
%src0.fabs = call float @llvm.fabs.f32(float %src0)
%cvt = tail call <2 x half> @llvm.amdgcn.cvt.sr.f16.f32(<2 x half> %old, float %src0.fabs, i32 %src1, i1 false)
store <2 x half> %cvt, ptr addrspace(1) %out, align 8
ret void
}
define amdgpu_ps void @test_cvt_sr_f16_f32_fneg(ptr addrspace(1) %out, float %src0, i32 %src1) {
; GFX950-LABEL: test_cvt_sr_f16_f32_fneg:
; GFX950: ; %bb.0:
; GFX950-NEXT: global_load_dword v4, v[0:1], off
; GFX950-NEXT: v_xor_b32_e32 v2, 0x80000000, v2
; GFX950-NEXT: s_waitcnt vmcnt(0)
; GFX950-NEXT: v_cvt_sr_f16_f32 v4, v2, v3
; GFX950-NEXT: global_store_dword v[0:1], v4, off
; GFX950-NEXT: s_endpgm
%old = load <2 x half>, ptr addrspace(1) %out, align 4
%src0.fneg = fneg float %src0
%cvt = tail call <2 x half> @llvm.amdgcn.cvt.sr.f16.f32(<2 x half> %old, float %src0.fneg, i32 %src1, i1 false)
store <2 x half> %cvt, ptr addrspace(1) %out, align 8
ret void
}
|