<div dir="ltr">Thank you! :-)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 3, 2019 at 9:10 AM Krzysztof Parzyszek <<a href="mailto:kparzysz@quicinc.com">kparzysz@quicinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://reviews.llvm.org/D60208" rel="noreferrer" target="_blank">https://reviews.llvm.org/D60208</a><br>
<br>
-- <br>
Krzysztof Parzyszek <a href="mailto:kparzysz@quicinc.com" target="_blank">kparzysz@quicinc.com</a> LLVM compiler development<br>
<br>
-----Original Message-----<br>
From: llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> On Behalf Of Krzysztof Parzyszek via llvm-dev<br>
Sent: Wednesday, April 3, 2019 10:13 AM<br>
To: Bill Wendling <<a href="mailto:isanbard@gmail.com" target="_blank">isanbard@gmail.com</a>>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
Subject: Re: [llvm-dev] [EXT] Inline ASM Question<br>
<br>
This is a bug in X86's ISel lowering: it does not take "getBooleanContents" into account when extending the immediate value to 64 bits:<br>
<br>
case 'i': {<br>
// Literal immediates are always ok.<br>
if (ConstantSDNode *CST = dyn_cast<ConstantSDNode>(Op)) {<br>
// Widen to 64 bits here to get it sign extended.<br>
Result = DAG.getTargetConstant(CST->getSExtValue(), SDLoc(Op), MVT::i64);<br>
break;<br>
}<br>
<br>
-- <br>
Krzysztof Parzyszek mailto:<a href="mailto:kparzysz@quicinc.com" target="_blank">kparzysz@quicinc.com</a> LLVM compiler development<br>
<br>
From: llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> On Behalf Of Bill Wendling via llvm-dev<br>
Sent: Wednesday, April 3, 2019 1:30 AM<br>
To: llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
Subject: [EXT] [llvm-dev] Inline ASM Question<br>
<br>
The code below is triggering some weird behavior that's different from how gcc treats this inline asm. Clang keeps the original type of "loc" as "bool", which generates an "i1 true" after inlining. So far so good. However, during ISEL, the "true" is converted to a signed integer. So when it's evaluated, the result is this:<br>
<br>
.quad (42+(-1))-.Ltmp0<br>
<br>
(notice the "-1"). GCC emits a positive one instead:<br>
<br>
.quad 42 + 1 - .Ltmp0<br>
<br>
I'm not sure where the problem lies. Should the inline asm promote the "i1" to "i32" during ISEL? Should it be promoted during inlining? Is there a situation where we require the value to be "i1"?<br>
<br>
-bw<br>
<br>
typedef _Bool bool;<br>
<br>
static inline<br>
__attribute__((__always_inline__))<br>
bool bar(bool loc) {<br>
asm(".quad 42 + %c0 - .\n\t" : : "i" (loc));<br>
return 1;<br>
}<br>
<br>
int foo(void) {<br>
return bar(1);<br>
}<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>