<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Invalid instructions generated for bitfield within a global structure."
href="https://llvm.org/bugs/show_bug.cgi?id=27901">27901</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Invalid instructions generated for bitfield within a global structure.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Backend: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>iains-llvm@btconnect.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16425" name="attach_16425" title="testcase .ll">attachment 16425</a> <a href="attachment.cgi?id=16425&action=edit" title="testcase .ll">[details]</a></span>
testcase .ll
For 32bit powerpc; for at least 3.8 and trunk. For Linux (no PIC) and for
Darwin (fPIC, -fno-common) invalid insns are generated
original c (reduced from a GCC ABI compatibility test) is;
cat reduced-t002.c:
enum E4 { e4_0, e4_1, e4_2, e4_3, e4_253 = 253, e4_254, e4_255 };
struct S482 {
enum E4 a : 18;
char b;
};
struct S482 s482;
void test482(void) {
s482.a = e4_255;
}
====
Linux;
clang -target powerpc-gnu-linux reduced-t002.ll -fverbose-asm -save-temps -c
-mllvm -print-after-all
# *** IR Dump After Live DEBUG_VALUE analysis ***:
# Machine code for function test482: Post SSA
Frame Objects:
fi#-1: size=4, align=4, fixed, at location [SP-4]
BB#0: derived from LLVM BB %entry
STW %R31, -4, %R1
%R1<def,tied3> = STWU %R1, -16, %R1<tied0>
%R31<def> = OR %R1, %R1
%R3<def> = ADDIS <ga:@s482>[TF=16], <ga:@s482>[TF=32]
%R4<def> = LBZ 2, %R3; mem:LD1[bitcast (%struct.S482* @s482 to
i24*)+2](align=2)
%R5<def> = LIS <ga:@s482>[TF=32]
%R6<def> = LI 63
%R4<def> = ORI %R4<kill>, 16320
STHX %R6<kill>, %R5<kill>, <ga:@s482>[TF=16]; mem:ST2[bitcast
(%struct.S482* @s482 to i24*)](align=4)
STB %R4<kill>, 2, %R3<kill>; mem:ST1[bitcast (%struct.S482* @s482 to
i24*)+2](align=2)
%R1<def> = ADDI %R1, 16
%R31<def> = LWZ -4, %R1
BLR %LR<imp-use>, %RM<imp-use>
# End machine code for function test482.
reduced-t002.s:12:11: error: invalid operand for instruction
addis 3, s482@l, s482@ha
^
reduced-t002.s:17:13: error: invalid operand for instruction
sthx 6, 5, s482@l
^
Darwin:
clang -target powerpc-apple-darwin reduced-t002.c -fno-common -fverbose-asm
-save-temps -c -mllvm -print-machineinstr
# After Live DEBUG_VALUE analysis:
# Machine code for function test482: Post SSA
Frame Objects:
fi#-1: size=4, align=4, fixed, at location [SP-4]
BB#0: derived from LLVM BB %entry
%R0<def> = MFLR %LR<imp-use>
STW %R31, -4, %R1
STW %R0, 8, %R1
%R1<def,tied3> = STWU %R1, -32, %R1<tied0>
%R31<def> = OR %R1, %R1
MovePCtoLR %LR<imp-def>
%R2<def> = MFLR %LR<imp-use>
%R2<def> = ADDIS %R2<kill>, <ga:@s482>[TF=34]
%R3<def> = ADD4 %R2, <ga:@s482>[TF=18]
%R4<def> = LBZ 2, %R3; mem:LD1[bitcast (%struct.S482* @s482 to
i24*)+2](align=2)
%R5<def> = LI 63
%R4<def> = ORI %R4<kill>, 16320
STHX %R5<kill>, %R2<kill>, <ga:@s482>[TF=18]; mem:ST2[bitcast
(%struct.S482* @s482 to i24*)](align=4)
STB %R4<kill>, 2, %R3<kill>; mem:ST1[bitcast (%struct.S482* @s482 to
i24*)+2](align=2)
%R1<def> = ADDI %R1, 32
%R0<def> = LWZ 8, %R1
%R31<def> = LWZ -4, %R1
MTLR %R0, %LR<imp-def>
BLR %LR<imp-use>, %RM<imp-use>
# End machine code for function test482.
reduced-t002.s:20:14: error: invalid operand for instruction
add r3, r2, lo16(_s482-L0$pb)
^
reduced-t002.s:24:15: error: invalid operand for instruction
sthx r5, r2, lo16(_s482-L0$pb)
^</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>