[llvm-commits] [llvm] r61092 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll

Dan Gohman gohman at apple.com
Tue Dec 16 13:22:54 PST 2008


Hi Evan,

I'm seeing this error trigger when building libgomp on x86_64-linux-gnu.
I've attached a reduced LLVM IR testcase.

Here is the relevant C code, from libgomp/config/linux/x86/futex.h:

static inline void
futex_wake (int *addr, int count)
{
  long res;

  __asm volatile ("syscall"
                  : "=a" (res)
                  : "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAKE),
"d"(count)
                  : "r11", "rcx", "memory");
}

SYS_futex here is a constant. Would it be possible to support this
specific case?

Dan

On Tue, 2008-12-16 at 18:21 +0000, Evan Cheng wrote:
> Author: evancheng
> Date: Tue Dec 16 12:21:39 2008
> New Revision: 61092
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=61092&view=rev
> Log:
> 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.
> 
> Modified:
>     llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
>     llvm/trunk/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll
> 
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=61092&r1=61091&r2=61092&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Dec 16 12:21:39 2008
> @@ -5048,20 +5048,21 @@
>      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;
>        }
>      }
>      
> 
> Modified: llvm/trunk/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll?rev=61092&r1=61091&r2=61092&view=diff
> 
> ==============================================================================
> --- llvm/trunk/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll (original)
> +++ llvm/trunk/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll Tue Dec 16 12:21:39 2008
> @@ -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"
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omp_unset_nest_lock.ll
Type: text/x-matlab
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081216/30647db6/attachment.bin>


More information about the llvm-commits mailing list