[llvm-bugs] [Bug 37397] New: [GlobalISel][AArch64] i1 value in aggregate not zero-extend prior to store
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 9 12:40:56 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37397
Bug ID: 37397
Summary: [GlobalISel][AArch64] i1 value in aggregate not
zero-extend prior to store
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: AArch64
Assignee: unassignedbugs at nondot.org
Reporter: tstellar at redhat.com
CC: efriedma at codeaurora.org, jistone at redhat.com,
llvm-bugs at lists.llvm.org
Blocks: 36649
This testcase comes from https://github.com/rust-lang/rust/issues/50516 and
shows that GlobalISel does not zero-extend an i1 value to 8-bits prior to
writing it to memory:
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
define void @i1_store() {
start:
%tmp0 = alloca { i32, i1 }, align 4
%tmp1 = call { i32, i1 } @foo()
store { i32, i1 } %tmp1, { i32, i1 }* %tmp0, align 4
ret void
}
declare { i32, i1 } @foo()
llc -O0 gives us:
sub sp, sp, #32 // =32
str x30, [sp, #16] // 8-byte Folded Spill
.cfi_def_cfa_offset 32
.cfi_offset w30, -16
bl foo
// implicit-def: $x8
mov w9, w0
bfxil x8, x9, #0, #32
mov w9, w1
bfi x8, x9, #32, #1
str x8, [sp, #8]
i1 values are stored in memory as 8-bit values, but it is expected that value
will be either 0x0 or 0x1. In this case, since Bits 33-39 of x8 remain
uninitialized, when this value is loaded there will be random values in the
high 7-bits.
Fast-ISel seems to handle this test case correctly:
sub sp, sp, #32 // =32
str x30, [sp, #16] // 8-byte Folded Spill
.cfi_def_cfa_offset 32
.cfi_offset w30, -16
bl foo
str w0, [sp, #8]
and w0, w1, #0x1
strb w0, [sp, #12]
ldr x30, [sp, #16] // 8-byte Folded Reload
add sp, sp, #32 // =32
ret
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=36649
[Bug 36649] [meta] 6.0.1 Release Blockers
--
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/20180509/b73631be/attachment.html>
More information about the llvm-bugs
mailing list