[LLVMbugs] [Bug 21631] New: [AArch64] Poor codegen for BitfieldInsertOpFromOr when operands are commuted
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Nov 21 10:10:11 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=21631
Bug ID: 21631
Summary: [AArch64] Poor codegen for BitfieldInsertOpFromOr when
operands are commuted
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: AArch64
Assignee: unassignedbugs at nondot.org
Reporter: mcrosier at codeaurora.org
CC: apazos at codeaurora.org, james.molloy at arm.com,
llvmbugs at cs.uiuc.edu, t.p.northover at gmail.com
Classification: Unclassified
AFAICT, we can generate
lsl w8, w2, #16
and w0, w8, #0xff0000
bfxil w0, w1, #0, #16
as
and w0, w1, #0xffff
bfi w0, w2, #16, #8
removing the extra shift instruction.
Test cases:
$> more test.ll
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"
define i32 @good(i32 %x, i32 %code, i32 %mode) {
entry:
%bf.value = and i32 %code, 65535
%bf.value2 = shl i32 %mode, 16
%bf.shl = and i32 %bf.value2, 16711680
%bf.set = or i32 %bf.shl, %bf.value
ret i32 %bf.set
}
define i32 @bad(i32 %x, i32 %code, i32 %mode) {
entry:
%bf.value = and i32 %code, 65535
%bf.value2 = shl i32 %mode, 16
%bf.shl = and i32 %bf.value2, 16711680
%bf.set = or i32 %bf.value, %bf.shl
ret i32 %bf.set
}
Reproduce:
$> llc -O3 test.ll -o -
.text
.file "test.ll"
.globl good
.align 2
.type good, at function
good: // @good
.cfi_startproc
// BB#0: // %entry
and w0, w1, #0xffff
bfi w0, w2, #16, #8
ret
.Ltmp1:
.size good, .Ltmp1-good
.cfi_endproc
.globl bad
.align 2
.type bad, at function
bad: // @bad
.cfi_startproc
// BB#0: // %entry
lsl w8, w2, #16
and w0, w8, #0xff0000
bfxil w0, w1, #0, #16
ret
.Ltmp3:
.size bad, .Ltmp3-bad
.cfi_endproc
--
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/20141121/84a83f80/attachment.html>
More information about the llvm-bugs
mailing list