Add support for inline assembly with output operand that do not naturally go in the register class it is constrained to (eg. double in a 32-bit GPR as in the PR).
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 20645 Build 20645: arc lint + arc unit
Event Timeline
Could you separate the "add support for matching input" part into a separate patch? I'm having trouble following what exactly you're trying to do.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7733 | Is this change necessary? getCopyFromRegs should do the appropriate int->float bitcast, I think. | |
test/CodeGen/ARM/pr34170.ll | ||
1 ↗ | (On Diff #152299) | Please pick a different filename for this file. And I'd like to see tests for float and double inputs and outputs, in both soft-float and hard-float modes. |
Hi Eli,
Again my apologies for the delay, my mail filter put the notification for your comments in the wrong folder. Should be fixed now and I'll keep an eye on phabricator directly to make sure it is. I've replied to your comments inline, will add the float testcase that you asked shortly.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7733 | It's not about int->float but in this case about i32 (ResultType) -> i64 (Val). It's much in the same spirit as what happens in GetRegistersForValue for input operands. As you can see here we only record the type for output but don't do the bitcase since it must be done *after* the asm call (as opposed to inputs where it must be done before). | |
test/CodeGen/ARM/pr34170.ll | ||
1 ↗ | (On Diff #152299) | So as not to repeat the same mistake what is the rule on using the PR number for the test? I can see quite a few tests with the same sort of name, some with very close PR number. Would inline-asm-convert-crash.ll be ok? |
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7733 | Oh, right, getCopyFromRegs doesn't do the bitcast because it thinks the destination type is i64. I'm not really convinced going through i64 is the right approach here (it only does the right thing on ARM because i64 isn't legal), but I guess it's okay given the existing precedent. | |
test/CodeGen/ARM/pr34170.ll | ||
1 ↗ | (On Diff #152299) | Sometimes people use the PR number because there isn't any good alternative, but best practice is to describe what the file is testing, not why you're adding the test. So something like inline-asm-float-gpr.ll. (You can put a reference to the bug as a comment in the test if you think it's helpful.) |
Is this change necessary? getCopyFromRegs should do the appropriate int->float bitcast, I think.