[LLVMbugs] [Bug 23346] New: attempting to use cmpxchg16b in inline assembly results in "error in backend: Cannot select: 0x1b567b0: i64 = build_pair 0x1b569c0, 0x1b55288 [ORD=31] [ID=68]"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Apr 25 00:48:08 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23346
Bug ID: 23346
Summary: attempting to use cmpxchg16b in inline assembly
results in "error in backend: Cannot select:
0x1b567b0: i64 = build_pair 0x1b569c0, 0x1b55288
[ORD=31] [ID=68]"
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: vas at vastheman.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 14255
--> https://llvm.org/bugs/attachment.cgi?id=14255&action=edit
Preprocessed source
On CentOS 7 using llvm/clang 2.5 with the following source:
#include <stdint.h>
#include <assert.h>
static inline __int128 CompareExchange(
__int128 *val,
__int128 cmp,
__int128 xchg)
{
__int128 result;
__asm__ __volatile__ ("lock cmpxchg16b %0" : "+m" (*val), "=A" (result) :
"A" (cmp), "c" ((int64_t)(xchg >> 64)), "b" ((int64_t)xchg));
return result;
}
int main(int argc, char *argv[])
{
__int128 val = 0;
assert(CompareExchange(&val, 1, 2) == 0);
assert(val == 0);
assert(CompareExchange(&val, 0, 1) == 0);
assert(val == 1);
assert(CompareExchange(&val, 2, 3) == 1);
assert(val == 1);
assert(CompareExchange(&val, 1, 2) == 1);
assert(val == 2);
return 0;
}
Compilation fails with the following error:
fatal error: error in backend: Cannot select: 0x1b567b0: i64 = build_pair
0x1b569c0, 0x1b55288 [ORD=31] [ID=68]
0x1b569c0: i32,ch,glue = CopyFromReg 0x1b59140, 0x1b52c68, 0x1b59140:1
[ORD=31] [ID=66]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b59140: ch,glue = inlineasm 0x1b57298, 0x1b52638, 0x1b56ff0, 0x1b53190,
0x1b575b0, 0x1b557b0, 0x1b573a0, 0x1b52c68, 0x1b55390, 0x1b586f0, 0x1b52c68,
0x1b55390, 0x1b5a050, 0x1b59350, 0x1b5a050, 0x1b52848, 0x1b575b0, 0x1b557b0,
0x1b52b60, 0x1b52530, 0x1b57298:1 [ORD=31] [ID=65]
0x1b52638: i64 = TargetExternalSymbol'lock cmpxchg16b $0' [ID=13]
0x1b53190: i64 = TargetConstant<25> [ID=15]
0x1b575b0: i64 = TargetConstant<14> [ID=16]
0x1b557b0: i64,ch = load 0x1b5acb0, 0x1b55bd0, 0x1b56ac8<LD8[%4]>
[ORD=24] [ID=55]
0x1b55bd0: i64 = FrameIndex<3> [ID=10]
0x1b56ac8: i64 = undef [ID=3]
0x1b573a0: i32 = TargetConstant<18> [ID=17]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b586f0: i32 = TargetConstant<17> [ID=20]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b5a050: i32 = TargetConstant<9> [ID=22]
0x1b59350: i64 = Register %RCX [ID=21]
0x1b5a050: i32 = TargetConstant<9> [ID=22]
0x1b52848: i64 = Register %RBX [ID=23]
0x1b575b0: i64 = TargetConstant<14> [ID=16]
0x1b557b0: i64,ch = load 0x1b5acb0, 0x1b55bd0, 0x1b56ac8<LD8[%4]>
[ORD=24] [ID=55]
0x1b55bd0: i64 = FrameIndex<3> [ID=10]
0x1b56ac8: i64 = undef [ID=3]
0x1b52b60: i32 = TargetConstant<12> [ID=24]
0x1b52530: i32 = Register %EFLAGS [ID=25]
0x1b57298: ch,glue = CopyToReg 0x1b52d70, 0x1b52848, 0x1b58d20,
0x1b52d70:1 [ORD=31] [ID=64]
0x1b52848: i64 = Register %RBX [ID=23]
0x1b58d20: i64,ch = load 0x1b5a470, 0x1b58a08,
0x1b56ac8<LD8[%3](align=16)> [ORD=20] [ID=47]
0x1b58a08: i64 = FrameIndex<2> [ID=6]
0x1b56ac8: i64 = undef [ID=3]
0x1b52d70: ch,glue = CopyToReg 0x1b5a578, 0x1b59350, 0x1b579d0,
0x1b5a578:1 [ORD=31] [ID=63]
0x1b59350: i64 = Register %RCX [ID=21]
0x1b579d0: i64,ch = CopyFromReg 0x1b3c860, 0x1b566a8 [ORD=19] [ID=37]
0x1b566a8: i64 = Register %vreg9 [ID=8]
0x1b5a578: ch,glue = CopyToReg 0x1b55498, 0x1b55390, 0x1b57be0,
0x1b5a260:1 [ORD=31] [ID=62]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b57be0: i32 = truncate 0x1b576b8 [ORD=31] [ID=60]
0x1b576b8: i64 = srl 0x1b59038, 0x1b52f80 [ORD=31] [ID=57]
0x1b59038: i64,ch = load 0x1b5acb0, 0x1b56ee8,
0x1b56ac8<LD8[%5](align=16)> [ORD=25] [ID=56]
0x1b56ee8: i64 = FrameIndex<4> [ID=11]
0x1b56ac8: i64 = undef [ID=3]
0x1b52f80: i8 = Constant<32> [ID=31]
0x1b5a260: ch,glue = CopyToReg 0x1b55498, 0x1b52c68, 0x1b52a58
[ORD=31] [ID=61]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b52a58: i32 = truncate 0x1b59038 [ORD=31] [ID=58]
0x1b59038: i64,ch = load 0x1b5acb0, 0x1b56ee8,
0x1b56ac8<LD8[%5](align=16)> [ORD=25] [ID=56]
0x1b56ee8: i64 = FrameIndex<4> [ID=11]
0x1b56ac8: i64 = undef [ID=3]
0x1b55288: i32,ch,glue = CopyFromReg 0x1b569c0:1, 0x1b55390, 0x1b569c0:2
[ORD=31] [ID=67]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b569c0: i32,ch,glue = CopyFromReg 0x1b59140, 0x1b52c68, 0x1b59140:1
[ORD=31] [ID=66]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b59140: ch,glue = inlineasm 0x1b57298, 0x1b52638, 0x1b56ff0,
0x1b53190, 0x1b575b0, 0x1b557b0, 0x1b573a0, 0x1b52c68, 0x1b55390, 0x1b586f0,
0x1b52c68, 0x1b55390, 0x1b5a050, 0x1b59350, 0x1b5a050, 0x1b52848, 0x1b575b0,
0x1b557b0, 0x1b52b60, 0x1b52530, 0x1b57298:1 [ORD=31] [ID=65]
0x1b52638: i64 = TargetExternalSymbol'lock cmpxchg16b $0' [ID=13]
0x1b53190: i64 = TargetConstant<25> [ID=15]
0x1b575b0: i64 = TargetConstant<14> [ID=16]
0x1b557b0: i64,ch = load 0x1b5acb0, 0x1b55bd0, 0x1b56ac8<LD8[%4]>
[ORD=24] [ID=55]
0x1b55bd0: i64 = FrameIndex<3> [ID=10]
0x1b56ac8: i64 = undef [ID=3]
0x1b573a0: i32 = TargetConstant<18> [ID=17]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b586f0: i32 = TargetConstant<17> [ID=20]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b5a050: i32 = TargetConstant<9> [ID=22]
0x1b59350: i64 = Register %RCX [ID=21]
0x1b5a050: i32 = TargetConstant<9> [ID=22]
0x1b52848: i64 = Register %RBX [ID=23]
0x1b575b0: i64 = TargetConstant<14> [ID=16]
0x1b557b0: i64,ch = load 0x1b5acb0, 0x1b55bd0, 0x1b56ac8<LD8[%4]>
[ORD=24] [ID=55]
0x1b55bd0: i64 = FrameIndex<3> [ID=10]
0x1b56ac8: i64 = undef [ID=3]
0x1b52b60: i32 = TargetConstant<12> [ID=24]
0x1b52530: i32 = Register %EFLAGS [ID=25]
0x1b57298: ch,glue = CopyToReg 0x1b52d70, 0x1b52848, 0x1b58d20,
0x1b52d70:1 [ORD=31] [ID=64]
0x1b52848: i64 = Register %RBX [ID=23]
0x1b58d20: i64,ch = load 0x1b5a470, 0x1b58a08,
0x1b56ac8<LD8[%3](align=16)> [ORD=20] [ID=47]
0x1b58a08: i64 = FrameIndex<2> [ID=6]
0x1b56ac8: i64 = undef [ID=3]
0x1b52d70: ch,glue = CopyToReg 0x1b5a578, 0x1b59350, 0x1b579d0,
0x1b5a578:1 [ORD=31] [ID=63]
0x1b59350: i64 = Register %RCX [ID=21]
0x1b579d0: i64,ch = CopyFromReg 0x1b3c860, 0x1b566a8 [ORD=19]
[ID=37]
0x1b566a8: i64 = Register %vreg9 [ID=8]
0x1b5a578: ch,glue = CopyToReg 0x1b55498, 0x1b55390, 0x1b57be0,
0x1b5a260:1 [ORD=31] [ID=62]
0x1b55390: i32 = Register %EDX [ID=19]
0x1b57be0: i32 = truncate 0x1b576b8 [ORD=31] [ID=60]
0x1b576b8: i64 = srl 0x1b59038, 0x1b52f80 [ORD=31] [ID=57]
0x1b59038: i64,ch = load 0x1b5acb0, 0x1b56ee8,
0x1b56ac8<LD8[%5](align=16)> [ORD=25] [ID=56]
0x1b52f80: i8 = Constant<32> [ID=31]
0x1b5a260: ch,glue = CopyToReg 0x1b55498, 0x1b52c68, 0x1b52a58
[ORD=31] [ID=61]
0x1b52c68: i32 = Register %EAX [ID=18]
0x1b52a58: i32 = truncate 0x1b59038 [ORD=31] [ID=58]
0x1b59038: i64,ch = load 0x1b5acb0, 0x1b56ee8,
0x1b56ac8<LD8[%5](align=16)> [ORD=25] [ID=56]
In function: CompareExchange
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/tst-aed623.c
clang: note: diagnostic msg: /tmp/tst-aed623.sh
clang: note: diagnostic msg:
********************
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150425/81c5894e/attachment.html>
More information about the llvm-bugs
mailing list