reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9-32BANK %s
; RUN: llc -mtriple=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8-32BANK %s
; RUN: llc -mtriple=amdgcn -mcpu=gfx810 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8-16BANK %s

define amdgpu_ps half @interp_f16(float inreg %i, float inreg %j, i32 inreg %m0) #0 {
; GFX9-32BANK-LABEL: interp_f16:
; GFX9-32BANK:       ; %bb.0: ; %main_body
; GFX9-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX9-32BANK-NEXT:    v_mov_b32_e32 v0, s0
; GFX9-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX9-32BANK-NEXT:    v_interp_p1ll_f16 v1, v0, attr2.y
; GFX9-32BANK-NEXT:    v_mov_b32_e32 v2, s1
; GFX9-32BANK-NEXT:    v_interp_p1ll_f16 v0, v0, attr2.y high
; GFX9-32BANK-NEXT:    v_interp_p2_legacy_f16 v1, v2, attr2.y, v1
; GFX9-32BANK-NEXT:    v_interp_p2_legacy_f16 v0, v2, attr2.y, v0 high
; GFX9-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX9-32BANK-NEXT:    v_add_f16_e32 v0, v1, v0
; GFX9-32BANK-NEXT:    ; return to shader part epilog
;
; GFX8-32BANK-LABEL: interp_f16:
; GFX8-32BANK:       ; %bb.0: ; %main_body
; GFX8-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-32BANK-NEXT:    v_mov_b32_e32 v0, s0
; GFX8-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX8-32BANK-NEXT:    v_interp_p1ll_f16 v1, v0, attr2.y
; GFX8-32BANK-NEXT:    v_mov_b32_e32 v2, s1
; GFX8-32BANK-NEXT:    v_interp_p1ll_f16 v0, v0, attr2.y high
; GFX8-32BANK-NEXT:    v_interp_p2_f16 v1, v2, attr2.y, v1
; GFX8-32BANK-NEXT:    v_interp_p2_f16 v0, v2, attr2.y, v0 high
; GFX8-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX8-32BANK-NEXT:    v_add_f16_e32 v0, v1, v0
; GFX8-32BANK-NEXT:    ; return to shader part epilog
;
; GFX8-16BANK-LABEL: interp_f16:
; GFX8-16BANK:       ; %bb.0: ; %main_body
; GFX8-16BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-16BANK-NEXT:    v_interp_mov_f32_e32 v0, p0, attr2.y
; GFX8-16BANK-NEXT:    v_mov_b32_e32 v1, s0
; GFX8-16BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX8-16BANK-NEXT:    v_interp_p1lv_f16 v2, v1, attr2.y, v0
; GFX8-16BANK-NEXT:    v_mov_b32_e32 v3, s1
; GFX8-16BANK-NEXT:    v_interp_p1lv_f16 v0, v1, attr2.y, v0 high
; GFX8-16BANK-NEXT:    v_interp_p2_f16 v2, v3, attr2.y, v2
; GFX8-16BANK-NEXT:    v_interp_p2_f16 v0, v3, attr2.y, v0 high
; GFX8-16BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX8-16BANK-NEXT:    v_add_f16_e32 v0, v2, v0
; GFX8-16BANK-NEXT:    ; return to shader part epilog
main_body:
  %p1_0 = call float @llvm.amdgcn.interp.p1.f16(float %i, i32 1, i32 2, i1 0, i32 %m0)
  %p2_0 = call half @llvm.amdgcn.interp.p2.f16(float %p1_0, float %j, i32 1, i32 2, i1 0, i32 %m0)
  %p1_1 = call float @llvm.amdgcn.interp.p1.f16(float %i, i32 1, i32 2, i1 1, i32 %m0)
  %p2_1 = call half @llvm.amdgcn.interp.p2.f16(float %p1_1, float %j, i32 1, i32 2, i1 1, i32 %m0)
  %res = fadd half %p2_0, %p2_1
  ret half %res
}

; check that m0 is setup correctly before the interp p1 instruction
define amdgpu_ps half @interp_p1_m0_setup(float inreg %i, float inreg %j, i32 inreg %m0) #0 {
; GFX9-32BANK-LABEL: interp_p1_m0_setup:
; GFX9-32BANK:       ; %bb.0: ; %main_body
; GFX9-32BANK-NEXT:    ;;#ASMSTART
; GFX9-32BANK-NEXT:    s_mov_b32 m0, 0
; GFX9-32BANK-NEXT:    ;;#ASMEND
; GFX9-32BANK-NEXT:    s_mov_b32 s3, m0
; GFX9-32BANK-NEXT:    v_mov_b32_e32 v0, s0
; GFX9-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX9-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX9-32BANK-NEXT:    v_interp_p1ll_f16 v0, v0, attr2.y
; GFX9-32BANK-NEXT:    v_mov_b32_e32 v1, s1
; GFX9-32BANK-NEXT:    v_interp_p2_legacy_f16 v0, v1, attr2.y, v0
; GFX9-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX9-32BANK-NEXT:    v_add_f16_e32 v0, s3, v0
; GFX9-32BANK-NEXT:    ; return to shader part epilog
;
; GFX8-32BANK-LABEL: interp_p1_m0_setup:
; GFX8-32BANK:       ; %bb.0: ; %main_body
; GFX8-32BANK-NEXT:    ;;#ASMSTART
; GFX8-32BANK-NEXT:    s_mov_b32 m0, 0
; GFX8-32BANK-NEXT:    ;;#ASMEND
; GFX8-32BANK-NEXT:    s_mov_b32 s3, m0
; GFX8-32BANK-NEXT:    v_mov_b32_e32 v0, s0
; GFX8-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX8-32BANK-NEXT:    v_interp_p1ll_f16 v0, v0, attr2.y
; GFX8-32BANK-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-32BANK-NEXT:    v_interp_p2_f16 v0, v1, attr2.y, v0
; GFX8-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX8-32BANK-NEXT:    v_add_f16_e32 v0, s3, v0
; GFX8-32BANK-NEXT:    ; return to shader part epilog
;
; GFX8-16BANK-LABEL: interp_p1_m0_setup:
; GFX8-16BANK:       ; %bb.0: ; %main_body
; GFX8-16BANK-NEXT:    ;;#ASMSTART
; GFX8-16BANK-NEXT:    s_mov_b32 m0, 0
; GFX8-16BANK-NEXT:    ;;#ASMEND
; GFX8-16BANK-NEXT:    s_mov_b32 s3, m0
; GFX8-16BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-16BANK-NEXT:    v_interp_mov_f32_e32 v0, p0, attr2.y
; GFX8-16BANK-NEXT:    v_mov_b32_e32 v1, s0
; GFX8-16BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX8-16BANK-NEXT:    v_interp_p1lv_f16 v0, v1, attr2.y, v0
; GFX8-16BANK-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-16BANK-NEXT:    v_interp_p2_f16 v0, v1, attr2.y, v0
; GFX8-16BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX8-16BANK-NEXT:    v_add_f16_e32 v0, s3, v0
; GFX8-16BANK-NEXT:    ; return to shader part epilog
main_body:
  %mx = call i32 asm sideeffect "s_mov_b32 m0, 0", "={m0}"() #0
  %p1_0 = call float @llvm.amdgcn.interp.p1.f16(float %i, i32 1, i32 2, i1 0, i32 %m0)
  %p2_0 = call half @llvm.amdgcn.interp.p2.f16(float %p1_0, float %j, i32 1, i32 2, i1 0, i32 %m0)
  %my = trunc i32 %mx to i16
  %mh = bitcast i16 %my to half
  %res = fadd half %p2_0, %mh
  ret half %res
}

; check that m0 is setup correctly before the interp p2 instruction
define amdgpu_ps half @interp_p2_m0_setup(float inreg %i, float inreg %j, i32 inreg %m0) #0 {
; GFX9-32BANK-LABEL: interp_p2_m0_setup:
; GFX9-32BANK:       ; %bb.0: ; %main_body
; GFX9-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX9-32BANK-NEXT:    v_mov_b32_e32 v0, s0
; GFX9-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX9-32BANK-NEXT:    v_interp_p1ll_f16 v0, v0, attr2.y
; GFX9-32BANK-NEXT:    ;;#ASMSTART
; GFX9-32BANK-NEXT:    s_mov_b32 m0, 0
; GFX9-32BANK-NEXT:    ;;#ASMEND
; GFX9-32BANK-NEXT:    s_mov_b32 s0, m0
; GFX9-32BANK-NEXT:    v_mov_b32_e32 v1, s1
; GFX9-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX9-32BANK-NEXT:    v_interp_p2_legacy_f16 v0, v1, attr2.y, v0
; GFX9-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX9-32BANK-NEXT:    v_add_f16_e32 v0, s0, v0
; GFX9-32BANK-NEXT:    ; return to shader part epilog
;
; GFX8-32BANK-LABEL: interp_p2_m0_setup:
; GFX8-32BANK:       ; %bb.0: ; %main_body
; GFX8-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-32BANK-NEXT:    v_mov_b32_e32 v0, s0
; GFX8-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX8-32BANK-NEXT:    v_interp_p1ll_f16 v0, v0, attr2.y
; GFX8-32BANK-NEXT:    ;;#ASMSTART
; GFX8-32BANK-NEXT:    s_mov_b32 m0, 0
; GFX8-32BANK-NEXT:    ;;#ASMEND
; GFX8-32BANK-NEXT:    s_mov_b32 s0, m0
; GFX8-32BANK-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-32BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-32BANK-NEXT:    v_interp_p2_f16 v0, v1, attr2.y, v0
; GFX8-32BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX8-32BANK-NEXT:    v_add_f16_e32 v0, s0, v0
; GFX8-32BANK-NEXT:    ; return to shader part epilog
;
; GFX8-16BANK-LABEL: interp_p2_m0_setup:
; GFX8-16BANK:       ; %bb.0: ; %main_body
; GFX8-16BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-16BANK-NEXT:    v_interp_mov_f32_e32 v0, p0, attr2.y
; GFX8-16BANK-NEXT:    v_mov_b32_e32 v1, s0
; GFX8-16BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
; GFX8-16BANK-NEXT:    v_interp_p1lv_f16 v0, v1, attr2.y, v0
; GFX8-16BANK-NEXT:    ;;#ASMSTART
; GFX8-16BANK-NEXT:    s_mov_b32 m0, 0
; GFX8-16BANK-NEXT:    ;;#ASMEND
; GFX8-16BANK-NEXT:    s_mov_b32 s0, m0
; GFX8-16BANK-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-16BANK-NEXT:    s_mov_b32 m0, s2
; GFX8-16BANK-NEXT:    v_interp_p2_f16 v0, v1, attr2.y, v0
; GFX8-16BANK-NEXT:    s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 0
; GFX8-16BANK-NEXT:    v_add_f16_e32 v0, s0, v0
; GFX8-16BANK-NEXT:    ; return to shader part epilog
main_body:
  %p1_0 = call float @llvm.amdgcn.interp.p1.f16(float %i, i32 1, i32 2, i1 0, i32 %m0)
  %mx = call i32 asm sideeffect "s_mov_b32 m0, 0", "={m0}"() #0
  %p2_0 = call half @llvm.amdgcn.interp.p2.f16(float %p1_0, float %j, i32 1, i32 2, i1 0, i32 %m0)
  %my = trunc i32 %mx to i16
  %mh = bitcast i16 %my to half
  %res = fadd half %p2_0, %mh
  ret half %res
}

; float @llvm.amdgcn.interp.p1.f16(i, attrchan, attr, high, m0)
declare float @llvm.amdgcn.interp.p1.f16(float, i32, i32, i1, i32) #0
; half @llvm.amdgcn.interp.p1.f16(p1, j, attrchan, attr, high, m0)
declare half @llvm.amdgcn.interp.p2.f16(float, float, i32, i32, i1, i32) #0
declare float @llvm.amdgcn.interp.mov(i32, i32, i32, i32) #0

attributes #0 = { nounwind readnone }