aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-12-16 18:21:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-12-16 18:21:39 +0000
commit09dc9c0c8363a689aa5559ae0e3ac33e381c2bb2 (patch)
tree7a4b901db8a1ea17926f451addd27abd09b615f9
parent8069f28a5de0a437b84b24896782c2a9a3a5bb18 (diff)
We have decided not to support inline asm where an output operand with a matching input operand with incompatible type (i.e. either one is a floating point and the other is an integer or the sizes of the types differ). SelectionDAGBuild will catch these and exit with an error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61092 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp23
-rw-r--r--test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll1
2 files changed, 13 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index a5a4896b70..853e0549f7 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -5048,20 +5048,21 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
SDISelAsmOperandInfo &OpInfo = ConstraintOperands[i];
// If this is an output operand with a matching input operand, look up the
- // matching input. It might have a different type (e.g. the output might be
- // i32 and the input i64) and we need to pick the larger width to ensure we
- // reserve the right number of registers.
+ // matching input. If their types mismatch, e.g. one is an integer, the
+ // other is floating point, or their sizes are different, flag it as an
+ // error.
if (OpInfo.hasMatchingInput()) {
SDISelAsmOperandInfo &Input = ConstraintOperands[OpInfo.MatchingInput];
if (OpInfo.ConstraintVT != Input.ConstraintVT) {
- assert(OpInfo.ConstraintVT.isInteger() &&
- Input.ConstraintVT.isInteger() &&
- "Asm constraints must be the same or different sized integers");
- if (OpInfo.ConstraintVT.getSizeInBits() <
- Input.ConstraintVT.getSizeInBits())
- OpInfo.ConstraintVT = Input.ConstraintVT;
- else
- Input.ConstraintVT = OpInfo.ConstraintVT;
+ if ((OpInfo.ConstraintVT.isInteger() !=
+ Input.ConstraintVT.isInteger()) ||
+ (OpInfo.ConstraintVT.getSizeInBits() !=
+ Input.ConstraintVT.getSizeInBits())) {
+ cerr << "Unsupported asm: input constraint with a matching output "
+ << "constraint of incompatible type!\n";
+ exit(1);
+ }
+ Input.ConstraintVT = OpInfo.ConstraintVT;
}
}
diff --git a/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll b/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll
index eace40c82b..00ca811610 100644
--- a/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll
+++ b/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll
@@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llc
+; XFAIL: *
; PR2356
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
target triple = "powerpc-apple-darwin9"