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
|
; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %s 2>&1 | FileCheck -check-prefix=ERR %s
; Diagnose register constraints that are not wide enough.
; ERR: error: couldn't allocate output register for constraint '{v[8:15]}'
define <9 x i32> @inline_asm_9xi32_in_8v_def() {
%asm = call <9 x i32> asm sideeffect "; def $0", "={v[8:15]}"()
ret <9 x i32> %asm
}
; ERR: error: couldn't allocate input reg for constraint '{v[8:15]}'
define void @inline_asm_9xi32_in_8v_use(<9 x i32> %val) {
call void asm sideeffect "; use $0", "{v[8:15]}"(<9 x i32> %val)
ret void
}
; ERR: error: couldn't allocate output register for constraint '{s[8:15]}'
define <9 x i32> @inline_asm_9xi32_in_8s_def() {
%asm = call <9 x i32> asm sideeffect "; def $0", "={s[8:15]}"()
ret <9 x i32> %asm
}
; Diagnose register constraints that are too wide.
; ERR: error: couldn't allocate output register for constraint '{v[8:16]}'
define <8 x i32> @inline_asm_8xi32_in_9v_def() {
%asm = call <8 x i32> asm sideeffect "; def $0", "={v[8:16]}"()
ret <8 x i32> %asm
}
; ERR: error: couldn't allocate input reg for constraint '{v[8:16]}'
define void @inline_asm_8xi32_in_9v_use(<8 x i32> %val) {
call void asm sideeffect "; use $0", "{v[8:16]}"(<8 x i32> %val)
ret void
}
; ERR: error: couldn't allocate output register for constraint '{s[8:16]}'
define <8 x i32> @inline_asm_8xi32_in_9s_def() {
%asm = call <8 x i32> asm sideeffect "; def $0", "={s[8:16]}"()
ret <8 x i32> %asm
}
; Diagnose mismatched scalars with register ranges
; ERR: error: couldn't allocate output register for constraint '{s[4:5]}'
define void @inline_asm_scalar_read_too_wide() {
%asm = call i32 asm sideeffect "; def $0 ", "={s[4:5]}"()
ret void
}
; ERR: error: couldn't allocate output register for constraint '{s[4:4]}'
define void @inline_asm_scalar_read_too_narrow() {
%asm = call i64 asm sideeffect "; def $0 ", "={s[4:4]}"()
ret void
}
; Single registers for vector types that are too wide or too narrow should be
; diagnosed.
; ERR: error: couldn't allocate input reg for constraint '{v8}'
define void @inline_asm_4xi32_in_v_use(<4 x i32> %val) {
call void asm sideeffect "; use $0", "{v8}"(<4 x i32> %val)
ret void
}
; ERR: error: couldn't allocate output register for constraint '{v8}'
define <4 x i32> @inline_asm_4xi32_in_v_def() {
%asm = call <4 x i32> asm sideeffect "; def $0", "={v8}"()
ret <4 x i32> %asm
}
; ERR: error: couldn't allocate output register for constraint '{s8}'
define <4 x i32> @inline_asm_4xi32_in_s_def() {
%asm = call <4 x i32> asm sideeffect "; def $0", "={s8}"()
ret <4 x i32> %asm
}
; ERR: error: couldn't allocate input reg for constraint '{v8}'
; ERR: error: couldn't allocate input reg for constraint 'v'
define void @inline_asm_2xi8_in_v_use(<2 x i8> %val) {
call void asm sideeffect "; use $0", "{v8}"(<2 x i8> %val)
call void asm sideeffect "; use $0", "v"(<2 x i8> %val)
ret void
}
; ERR: error: couldn't allocate output register for constraint '{v8}'
; ERR: error: couldn't allocate output register for constraint 'v'
define <2 x i8> @inline_asm_2xi8_in_v_def() {
%phys = call <2 x i8> asm sideeffect "; def $0", "={v8}"()
%virt = call <2 x i8> asm sideeffect "; def $0", "=v"()
%r = and <2 x i8> %phys, %virt
ret <2 x i8> %r
}
; ERR: error: couldn't allocate output register for constraint '{s8}'
; ERR: error: couldn't allocate output register for constraint 's'
define <2 x i8> @inline_asm_2xi8_in_s_def() {
%phys = call <2 x i8> asm sideeffect "; def $0", "={s8}"()
%virt = call <2 x i8> asm sideeffect "; def $0", "=s"()
%r = and <2 x i8> %phys, %virt
ret <2 x i8> %r
}
; The register is wide enough, but it does not satisfy alignment constraints:
; ERR: error: couldn't allocate input reg for constraint '{s[1:2]}'
define void @misaligned_sgpr_2xi32_in(<2 x i32> inreg %arg0) {
call void asm sideeffect "; use $0", "{s[1:2]}"(<2 x i32> %arg0)
ret void
}
; ERR: error: couldn't allocate input reg for constraint '{s[23:24]}'
define void @misaligned_sgpr_2xi32_in_23(<2 x i32> inreg %arg0) {
call void asm sideeffect "; use $0", "{s[23:24]}"(<2 x i32> %arg0)
ret void
}
; ERR: error: couldn't allocate input reg for constraint '{s[1:4]}'
define void @misaligned_sgpr_4xi32_in(<4 x i32> inreg %arg0) {
call void asm sideeffect "; use $0", "{s[1:4]}"(<4 x i32> %arg0)
ret void
}
; ERR: error: couldn't allocate input reg for constraint '{s[2:5]}'
define void @misaligned_sgpr_4xi32_in_2(<4 x i32> inreg %arg0) {
call void asm sideeffect "; use $0", "{s[2:5]}"(<4 x i32> %arg0)
ret void
}
; ERR: error: couldn't allocate output register for constraint '{s[1:2]}'
define <2 x i32> @misaligned_sgpr_2xi32_out() {
%asm = call <2 x i32> asm sideeffect "; def $0", "={s[1:2]}"()
ret <2 x i32> %asm
}
; ERR: error: couldn't allocate output register for constraint '{s[23:24]}'
define <2 x i32> @misaligned_sgpr_2xi32_out_23() {
%asm = call <2 x i32> asm sideeffect "; def $0", "={s[23:24]}"()
ret <2 x i32> %asm
}
; ERR: error: couldn't allocate output register for constraint '{s[1:4]}'
define <4 x i32> @misaligned_sgpr_4xi32_out() {
%asm = call <4 x i32> asm sideeffect "; def $0", "={s[1:4]}"()
ret <4 x i32> %asm
}
; ERR: error: couldn't allocate output register for constraint '{s[2:5]}'
define <4 x i32> @misaligned_sgpr_4xi32_out_2() {
%asm = call <4 x i32> asm sideeffect "; def $0", "={s[2:5]}"()
ret <4 x i32> %asm
}
|