<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Error with inline asm constraint "=A" on amd64"
   href="http://bugs.llvm.org/show_bug.cgi?id=32594">32594</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error with inline asm constraint "=A" on amd64
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>royger@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18257" name="attach_18257" title="Preprocessed C file">attachment 18257</a> <a href="attachment.cgi?id=18257&action=edit" title="Preprocessed C file">[details]</a></span>
Preprocessed C file

When the "=A" inline asm constrain is used to generate x86 64bit code clang
trows an internal error:

$ cc -o test test.c
fatal error: error in backend: Cannot select: t53: i64 = build_pair t51, t52
  t51: i32,ch,glue = CopyFromReg t50, Register:i32 %EAX, t50:1
    t31: i32 = Register %EAX
    t50: ch,glue = inlineasm t46, TargetExternalSymbol:i64'lock; cmpxchg16b
$2', MDNode:ch<0x803b3e4a8>, TargetConstant:i64<25>, TargetConstant:i32<18>,
Register:i32 %EAX, Register:i32 %EDX, TargetConstant:i32<196622>,
FrameIndex:i64<1>, TargetConstant:i32<9>, Register:i64 %RCX,
TargetConstant:i32<9>, Register:i64 %RBX, TargetConstant:i32<-2147483631>,
Register:i32 %vreg6, Register:i32 %vreg7, TargetConstant:i32<196622>,
FrameIndex:i64<1>, TargetConstant:i32<12>, Register:i32 %EFLAGS, t46:1
      t27: i64 = TargetExternalSymbol'lock; cmpxchg16b $2'
      t29: i64 = TargetConstant<25>
      t30: i32 = TargetConstant<18>
      t31: i32 = Register %EAX
      t32: i32 = Register %EDX
      t33: i32 = TargetConstant<196622>
      t3: i64 = FrameIndex<1>
      t36: i32 = TargetConstant<9>
      t34: i64 = Register %RCX
      t36: i32 = TargetConstant<9>
      t37: i64 = Register %RBX
      t47: i32 = TargetConstant<-2147483631>
      t43: i32 = Register %vreg6
      t45: i32 = Register %vreg7
      t33: i32 = TargetConstant<196622>
      t3: i64 = FrameIndex<1>
      t48: i32 = TargetConstant<12>
      t49: i32 = Register %EFLAGS
      t46: ch,glue = CopyToReg t38, Register:i32 %vreg7, t93, t44:1
        t45: i32 = Register %vreg7
        t93: i32 = truncate t92
          t92: i64 = srl t72, Constant:i8<32>
            t72: i64,ch = load<LD8[%6](align=16)> t81, t24, undef:i64
              t24: i64,ch = load<LD8[%oldp.addr]> t81, FrameIndex:i64<2>,
undef:i64
                t9: i64 = FrameIndex<2>
                t5: i64 = undef
              t5: i64 = undef
            t91: i8 = Constant<32>
        t44: ch,glue = CopyToReg t38, Register:i32 %vreg6, t90, t38:1
          t43: i32 = Register %vreg6
          t90: i32 = truncate t72
            t72: i64,ch = load<LD8[%6](align=16)> t81, t24, undef:i64
              t24: i64,ch = load<LD8[%oldp.addr]> t81, FrameIndex:i64<2>,
undef:i64
                t9: i64 = FrameIndex<2>
                t5: i64 = undef
              t5: i64 = undef
          t38: ch,glue = CopyToReg t35, Register:i64 %RBX, t23, t35:1
            t37: i64 = Register %RBX
            t23: i64,ch = load<LD8[%lo](align=16)> t81, FrameIndex:i64<4>,
undef:i64
              t15: i64 = FrameIndex<4>
              t5: i64 = undef
            t35: ch,glue = CopyToReg t26, Register:i64 %RCX, t22
              t34: i64 = Register %RCX
              t22: i64,ch = load<LD8[%hi]> t81, t73, undef:i64
                t73: i64 = or FrameIndex:i64<4>, Constant:i64<8>
                  t15: i64 = FrameIndex<4>
                  t20: i64 = Constant<8>
                t5: i64 = undef
  t52: i32,ch,glue = CopyFromReg t51:1, Register:i32 %EDX, t51:2
    t32: i32 = Register %EDX
    t51: i32,ch,glue = CopyFromReg t50, Register:i32 %EAX, t50:1
      t31: i32 = Register %EAX
      t50: ch,glue = inlineasm t46, TargetExternalSymbol:i64'lock; cmpxchg16b
$2', MDNode:ch<0x803b3e4a8>, TargetConstant:i64<25>, TargetConstant:i32<18>,
Register:i32 %EAX, Register:i32 %EDX, TargetConstant:i32<196622>,
FrameIndex:i64<1>, TargetConstant:i32<9>, Register:i64 %RCX,
TargetConstant:i32<9>, Register:i64 %RBX, TargetConstant:i32<-2147483631>,
Register:i32 %vreg6, Register:i32 %vreg7, TargetConstant:i32<196622>,
FrameIndex:i64<1>, TargetConstant:i32<12>, Register:i32 %EFLAGS, t46:1
        t27: i64 = TargetExternalSymbol'lock; cmpxchg16b $2'
        t29: i64 = TargetConstant<25>
        t30: i32 = TargetConstant<18>
        t31: i32 = Register %EAX
        t32: i32 = Register %EDX
        t33: i32 = TargetConstant<196622>
        t3: i64 = FrameIndex<1>
        t36: i32 = TargetConstant<9>
        t34: i64 = Register %RCX
        t36: i32 = TargetConstant<9>
        t37: i64 = Register %RBX
        t47: i32 = TargetConstant<-2147483631>
        t43: i32 = Register %vreg6
        t45: i32 = Register %vreg7
        t33: i32 = TargetConstant<196622>
        t3: i64 = FrameIndex<1>
        t48: i32 = TargetConstant<12>
        t49: i32 = Register %EFLAGS
        t46: ch,glue = CopyToReg t38, Register:i32 %vreg7, t93, t44:1
          t45: i32 = Register %vreg7
          t93: i32 = truncate t92
            t92: i64 = srl t72, Constant:i8<32>
              t72: i64,ch = load<LD8[%6](align=16)> t81, t24, undef:i64
                t24: i64,ch = load<LD8[%oldp.addr]> t81, FrameIndex:i64<2>,
undef:i64
                  t9: i64 = FrameIndex<2>
                  t5: i64 = undef
                t5: i64 = undef
              t91: i8 = Constant<32>
          t44: ch,glue = CopyToReg t38, Register:i32 %vreg6, t90, t38:1
            t43: i32 = Register %vreg6
            t90: i32 = truncate t72
              t72: i64,ch = load<LD8[%6](align=16)> t81, t24, undef:i64
                t24: i64,ch = load<LD8[%oldp.addr]> t81, FrameIndex:i64<2>,
undef:i64
                  t9: i64 = FrameIndex<2>
                  t5: i64 = undef
                t5: i64 = undef
            t38: ch,glue = CopyToReg t35, Register:i64 %RBX, t23, t35:1
              t37: i64 = Register %RBX
              t23: i64,ch = load<LD8[%lo](align=16)> t81, FrameIndex:i64<4>,
undef:i64
                t15: i64 = FrameIndex<4>
                t5: i64 = undef
              t35: ch,glue = CopyToReg t26, Register:i64 %RCX, t22
                t34: i64 = Register %RCX
                t22: i64,ch = load<LD8[%hi]> t81, t73, undef:i64
                  t73: i64 = or FrameIndex:i64<4>, Constant:i64<8>


                  t5: i64 = undef
In function: cmpxchg16b
cc: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM
3.8.0)
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/bin
cc: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.freebsd.org/submit/">https://bugs.freebsd.org/submit/</a> and include the crash backtrace, preprocessed
source, and associated run script.
cc: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
cc: note: diagnostic msg: /tmp/test-6fbfe6.c
cc: note: diagnostic msg: /tmp/test-6fbfe6.sh
cc: note: diagnostic msg:

********************

AFAICT clang is trying to use the eax:edx registers, which is wrong. On 64bit
the ax and dx registers are rax and rdx.

Attaching the preprocessed file and run scripts.

Thanks, Roger.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>