1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=WAVE64 %s
3# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=WAVE32 %s
4
5---
6
7name:            sitofp
8legalized:       true
9regBankSelected: true
10
11body: |
12  bb.0:
13    liveins: $sgpr0, $vgpr0, $vgpr3_vgpr4
14
15    ; WAVE64-LABEL: name: sitofp
16    ; WAVE64: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
17    ; WAVE64: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
18    ; WAVE64: [[COPY2:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
19    ; WAVE64: [[V_CVT_F32_I32_e64_:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e64 [[COPY]], 0, 0, implicit $mode, implicit $exec
20    ; WAVE64: [[V_CVT_F32_I32_e64_1:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e64 [[COPY1]], 0, 0, implicit $mode, implicit $exec
21    ; WAVE64: FLAT_STORE_DWORD [[COPY2]], [[V_CVT_F32_I32_e64_]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
22    ; WAVE64: FLAT_STORE_DWORD [[COPY2]], [[V_CVT_F32_I32_e64_1]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
23    ; WAVE32-LABEL: name: sitofp
24    ; WAVE32: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
25    ; WAVE32: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
26    ; WAVE32: [[COPY2:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
27    ; WAVE32: [[V_CVT_F32_I32_e64_:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e64 [[COPY]], 0, 0, implicit $mode, implicit $exec
28    ; WAVE32: [[V_CVT_F32_I32_e64_1:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e64 [[COPY1]], 0, 0, implicit $mode, implicit $exec
29    ; WAVE32: GLOBAL_STORE_DWORD [[COPY2]], [[V_CVT_F32_I32_e64_]], 0, 0, implicit $exec :: (store (s32), addrspace 1)
30    ; WAVE32: GLOBAL_STORE_DWORD [[COPY2]], [[V_CVT_F32_I32_e64_1]], 0, 0, implicit $exec :: (store (s32), addrspace 1)
31    %0:sgpr(s32) = COPY $sgpr0
32
33    %1:vgpr(s32) = COPY $vgpr0
34
35    %2:vgpr(p1) = COPY $vgpr3_vgpr4
36
37    ; sitofp s
38    %3:vgpr(s32) = G_SITOFP %0
39
40    ; sitofp v
41    %4:vgpr(s32) = G_SITOFP %1
42
43    G_STORE %3, %2 :: (store (s32), addrspace 1)
44    G_STORE %4, %2 :: (store (s32), addrspace 1)
45...
46
47---
48name: sitofp_s32_to_s16_vv
49legalized: true
50regBankSelected: true
51tracksRegLiveness: true
52
53body: |
54  bb.0:
55    liveins: $vgpr0
56
57    ; WAVE64-LABEL: name: sitofp_s32_to_s16_vv
58    ; WAVE64: liveins: $vgpr0
59    ; WAVE64: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
60    ; WAVE64: [[V_CVT_F32_I32_e32_:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e32 [[COPY]], implicit $mode, implicit $exec
61    ; WAVE64: %1:vgpr_32 = nofpexcept V_CVT_F16_F32_e32 [[V_CVT_F32_I32_e32_]], implicit $mode, implicit $exec
62    ; WAVE64: $vgpr0 = COPY %1
63    ; WAVE32-LABEL: name: sitofp_s32_to_s16_vv
64    ; WAVE32: liveins: $vgpr0
65    ; WAVE32: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
66    ; WAVE32: [[V_CVT_F32_I32_e32_:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e32 [[COPY]], implicit $mode, implicit $exec
67    ; WAVE32: %1:vgpr_32 = nofpexcept V_CVT_F16_F32_e32 [[V_CVT_F32_I32_e32_]], implicit $mode, implicit $exec
68    ; WAVE32: $vgpr0 = COPY %1
69    %0:vgpr(s32) = COPY $vgpr0
70    %1:vgpr(s16) = G_SITOFP %0
71    %2:vgpr(s32) = G_ANYEXT %1
72    $vgpr0 = COPY %2
73...
74
75---
76name: sitofp_s32_to_s16_vs
77legalized: true
78regBankSelected: true
79tracksRegLiveness: true
80
81body: |
82  bb.0:
83    liveins: $sgpr0
84
85    ; WAVE64-LABEL: name: sitofp_s32_to_s16_vs
86    ; WAVE64: liveins: $sgpr0
87    ; WAVE64: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
88    ; WAVE64: [[V_CVT_F32_I32_e32_:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e32 [[COPY]], implicit $mode, implicit $exec
89    ; WAVE64: %1:vgpr_32 = nofpexcept V_CVT_F16_F32_e32 [[V_CVT_F32_I32_e32_]], implicit $mode, implicit $exec
90    ; WAVE64: $vgpr0 = COPY %1
91    ; WAVE32-LABEL: name: sitofp_s32_to_s16_vs
92    ; WAVE32: liveins: $sgpr0
93    ; WAVE32: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
94    ; WAVE32: [[V_CVT_F32_I32_e32_:%[0-9]+]]:vgpr_32 = V_CVT_F32_I32_e32 [[COPY]], implicit $mode, implicit $exec
95    ; WAVE32: %1:vgpr_32 = nofpexcept V_CVT_F16_F32_e32 [[V_CVT_F32_I32_e32_]], implicit $mode, implicit $exec
96    ; WAVE32: $vgpr0 = COPY %1
97    %0:sgpr(s32) = COPY $sgpr0
98    %1:vgpr(s16) = G_SITOFP %0
99    %2:vgpr(s32) = G_ANYEXT %1
100    $vgpr0 = COPY %2
101...
102