GlobalISel: Handle 'n' inline asm constraint

This commit is contained in:
Matt Arsenault 2020-07-26 09:26:48 -04:00
parent 4033aa1467
commit 61ced4b87a
2 changed files with 10 additions and 0 deletions

View File

@ -658,6 +658,7 @@ bool InlineAsmLowering::lowerAsmOperandForConstraint(
default:
return false;
case 'i': // Simple Integer or Relocatable Constant
case 'n': // immediate integer with a known value.
if (ConstantInt *CI = dyn_cast<ConstantInt>(Val)) {
assert(CI->getBitWidth() <= 64 &&
"expected immediate to fit into 64-bits");

View File

@ -326,4 +326,13 @@ entry:
ret i32 %asm1
}
define amdgpu_kernel void @asm_constraint_n_n() {
; CHECK-LABEL: name: asm_constraint_n_n
; CHECK: bb.1 (%ir-block.0):
; CHECK: INLINEASM &"s_trap ${0:n}", 1 /* sideeffect attdialect */, 13 /* imm */, 10
; CHECK: S_ENDPGM 0
tail call void asm sideeffect "s_trap ${0:n}", "n"(i32 10) #1
ret void
}
!0 = !{i32 70}