Files
clang-p2996/llvm/test/CodeGen/AMDGPU/verify-duplicate-literal.mir
Jay Foad 5b18ef7256 [AMDGPU] Add verification for mandatory literals
Extend the literal operand checking in SIInstrInfo::verifyInstruction to
check VOP2 instructions like V_FMAAK_F32 which have a mandatory literal
operand. The rule is that src0 can also be a literal, but only if it is
the same literal value.

AMDGPUAsmParser::validateConstantBusLimitations already handles this
correctly.

Differential Revision: https://reviews.llvm.org/D126063
2022-05-20 16:14:00 +01:00

54 lines
1.5 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -mcpu=gfx1010 -run-pass machineverifier -o - %s | FileCheck %s
# Two uses of the same literal only count as one use of the constant bus.
---
name: use_duplicate_literal_cndmask
tracksRegLiveness: true
body: |
bb.0:
liveins: $vcc_lo
; CHECK-LABEL: name: use_duplicate_literal_cndmask
; CHECK: liveins: $vcc_lo
; CHECK: $vgpr0 = V_CNDMASK_B32_e64 0, 1234567, 0, 1234567, killed $vcc_lo, implicit $exec
$vgpr0 = V_CNDMASK_B32_e64 0, 1234567, 0, 1234567, killed $vcc_lo, implicit $exec
...
---
name: use_duplicate_literal_fma
tracksRegLiveness: true
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: use_duplicate_literal_fma
; CHECK: liveins: $vgpr0
; CHECK: $vgpr0 = V_FMA_F32_e64 0, $vgpr0, 0, 1077936128, 0, 1077936128, 0, 0, implicit $mode, implicit $exec
$vgpr0 = V_FMA_F32_e64 0, $vgpr0, 0, 1077936128, 0, 1077936128, 0, 0, implicit $mode, implicit $exec
...
---
name: use_duplicate_literal_fmaak
tracksRegLiveness: true
body: |
bb.0:
liveins: $vgpr0
$vgpr0 = V_FMAAK_F32 1077936128, $vgpr0, 1077936128, implicit $mode, implicit $exec
...
---
name: use_duplicate_literal_sop2
tracksRegLiveness: true
body: |
bb.0:
$sgpr0 = S_ADD_U32 12345, 12345, implicit-def $scc
...
---
name: use_duplicate_literal_sopc
tracksRegLiveness: true
body: |
bb.0:
S_CMP_LG_U32 305419896, 305419896, implicit-def $scc
...