[llvm-commits] [PATCH 03/11] (Patch) Mips specific inline asm: constraint 'I'
Eric Christopher
echristo at apple.com
Thu Apr 26 14:40:47 PDT 2012
On Apr 12, 2012, at 1:26 PM, Jack Carter <jcarter at mips.com> wrote:
> A signed 16 bit constant.
>
> The real test for this will be in the negative test.
>
>
> #include <stdio.h>
> main()
> {
> // Good: value is within range and is a short.
> short s_input = 7;short s_result = 0;short s_val = 3;
> __asm__ __volatile__(
> "addi %0,%1,%2" : "=r" (s_result) : "r" (s_input), "I" (s_val));
> printf ("mips_addi(%d,%d) = %d\n", s_input, s_val, s_result);
>
> // Good per GCC: value is within range but is an int.
> int i_val = 3;
> __asm__ __volatile__(
> "addi %0,%1,%2" : "=r" (s_result) : "r" (s_input), "I" (i_val));
> printf ("mips_addi(%d,%d) = %d\n", s_input, i_val, i_result);
>
> // Bad: value is outside of range even though marked as a short.
> s_val = 0x00100000;
> __asm__ __volatile__(
> "addi %0,%1,%2" : "=r" (s_result) : "r" (s_input), "I" (s_val));
> printf ("mips_addi(%d,%d) = %d\n", s_input, s_val, s_result);
> }
> ---
> lib/Target/Mips/MipsISelLowering.cpp | 39 ++++++++++++++++++++++++
> lib/Target/Mips/MipsISelLowering.h | 9 ++++++
> test/CodeGen/Mips/inlineasm-cnstrnt-bad-I-1.ll | 13 ++++++++
> test/CodeGen/Mips/inlineasm_constraint.ll | 20 ++++++++++++
> 4 files changed, 81 insertions(+), 0 deletions(-)
> create mode 100644 test/CodeGen/Mips/inlineasm-cnstrnt-bad-I-1.ll
> create mode 100644 test/CodeGen/Mips/inlineasm_constraint.ll
> <Constraint_I.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
This is OK.
-eric
More information about the llvm-commits
mailing list