-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Description
The backend does not ensure that both data operands are AGPR or VGPR for DS atomic cmpxchg
# After SI Fold Operands
# Machine code for function ds_atomic_cmpxchg_b32_ret_a_a__a: IsSSA, TracksLiveness
Function Live Ins: $vgpr0 in %8
bb.0 (%ir-block.0):
liveins: $vgpr0
%8:vgpr_32 = COPY $vgpr0
INLINEASM &"; def $0" [attdialect], $0:[regdef:AGPR_32], def %9:agpr_32
INLINEASM &"; def $0" [attdialect], $0:[regdef:AGPR_32], def %10:agpr_32
%13:vgpr_32 = COPY %9:agpr_32
%12:vgpr_32 = DS_CMPST_RTN_B32_gfx9 %8:vgpr_32, %13:vgpr_32, %10:agpr_32, 40, 0, implicit $exec :: (load store seq_cst monotonic (s32) on %ir.gep.0, addrspace 3)
%11:agpr_32 = COPY %12:vgpr_32
INLINEASM &"; use $0" [attdialect], $0:[reguse:AGPR_32], %11:agpr_32
SI_RETURN
# End machine code for function ds_atomic_cmpxchg_b32_ret_a_a__a.
*** Bad machine code: Invalid register class: both data operands should be VGPR or AGPR ***
- function: ds_atomic_cmpxchg_b32_ret_a_a__a
- basic block: %bb.0 (0x15b85f5a8)
- instruction: %12:vgpr_32 = DS_CMPST_RTN_B32_gfx9 %8:vgpr_32, %13:vgpr_32, %10:agpr_32, 40, 0, implicit $exec :: (load store seq_cst monotonic (s32) on %ir.gep.0, addrspace 3)
; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck %s
define void @ds_atomic_cmpxchg_b32_ret_av_av__av(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=^VA"()
%data1 = call i32 asm "; def $0", "=^VA"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "^VA"(i32 %result)
ret void
}
define void @ds_atomic_cmpxchg_b32_ret_av_av__v(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=^VA"()
%data1 = call i32 asm "; def $0", "=^VA"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "v"(i32 %result)
ret void
}
define void @ds_atomic_cmpxchg_b32_ret_av_av__a(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=^VA"()
%data1 = call i32 asm "; def $0", "=^VA"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "a"(i32 %result)
ret void
}
; FIXME: Broken
define void @ds_atomic_cmpxchg_b32_ret_a_a__a(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=a"()
%data1 = call i32 asm "; def $0", "=a"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "a"(i32 %result)
ret void
}
; FIXME: Broken
define void @ds_atomic_cmpxchg_b32_ret_a_a__v(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=a"()
%data1 = call i32 asm "; def $0", "=a"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "v"(i32 %result)
ret void
}
; FIXME: Broken
define void @ds_atomic_cmpxchg_b32_ret_v_a__v(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=v"()
%data1 = call i32 asm "; def $0", "=a"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "v"(i32 %result)
ret void
}
; FIXME: Broken
define void @ds_atomic_cmpxchg_b32_ret_a_v__v(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=a"()
%data1 = call i32 asm "; def $0", "=v"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "v"(i32 %result)
ret void
}
define void @ds_atomic_cmpxchg_b32_ret_v_v__a(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=v"()
%data1 = call i32 asm "; def $0", "=v"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "a"(i32 %result)
ret void
}
define void @ds_atomic_cmpxchg_b32_ret_av_v__av(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=^VA"()
%data1 = call i32 asm "; def $0", "=v"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "^VA"(i32 %result)
ret void
}
define void @ds_atomic_cmpxchg_b32_ret_v_av__av(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=v"()
%data1 = call i32 asm "; def $0", "=^VA"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "^VA"(i32 %result)
ret void
}
; FIXME: Broken
define void @ds_atomic_cmpxchg_b32_ret_av_a__av(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=^VA"()
%data1 = call i32 asm "; def $0", "=a"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "^VA"(i32 %result)
ret void
}
define void @ds_atomic_cmpxchg_b32_ret_a_av__av(ptr addrspace(3) %ptr) #0 {
%gep.0 = getelementptr inbounds [512 x float], ptr addrspace(3) %ptr, i32 0, i32 10
%data0 = call i32 asm "; def $0", "=a"()
%data1 = call i32 asm "; def $0", "=^VA"()
%pair = cmpxchg ptr addrspace(3) %gep.0, i32 %data0, i32 %data1 seq_cst monotonic
%result = extractvalue { i32, i1 } %pair, 0
call void asm "; use $0", "^VA"(i32 %result)
ret void
}
attributes #0 = { nounwind "amdgpu-waves-per-eu"="10,10" }