Open Quuxplusone opened 5 years ago
Attached vcvt_fixed_float_VFP-b24785.sh
(7218 bytes, text/x-sh): shell script
Attached vcvt_fixed_float_VFP-b24785.c
(91690 bytes, text/plain): testcase
I'm getting:
fatal error: error in backend: Unsupported asm: input constraint with a matching output constraint of incompatible type!
Is that what you see, too?
This is the reduced case:
a() {
int b;
float c;
__asm__("" : "=w"(c) : "0"(b));
}
$ clang -target thumbv7ve-yoe-linux-musleabi -c vcvt_fixed_float_VFP-b24785.c
vcvt_fixed_float_VFP-b24785.c:1:1: warning: type specifier missing, defaults to
'int'
[-Wimplicit-int]
a() {
^
vcvt_fixed_float_VFP-b24785.c:5:1: warning: control reaches end of non-void
function
[-Wreturn-type]
}
^
fatal error: error in backend: Unsupported asm: input constraint with a
matching output constraint of incompatible type!
I think the error is about int input with float output.
My inline-asm-fu is very rusty, but that sounds to me like a valid use of vcvt.
I see a three issues here:
1. ARMTargetLowering::getRegForInlineAsmConstraint should handle "w" with an
integer input (by returning &ARM::SPRRegClass and letting SelectionDAGBuilder
insert the appropriate cast).
2. patchMatchingInput in SelectionDAGBuilder.cpp emits a spurious error message
if you try to match an i32 with a f32, even if they would otherwise be
compatible.
3. patchMatchingInput should use emitInlineAsmError to emit error messages on
invalid inline asm, not report_fatal_error.
vcvt_fixed_float_VFP-b24785.sh
(7218 bytes, text/x-sh)vcvt_fixed_float_VFP-b24785.c
(91690 bytes, text/plain)