[LLVMbugs] [Bug 20578] New: missed optimization: recognize fnabs (FP negative absolute value) (x86-64)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Aug 7 10:51:51 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20578
Bug ID: 20578
Summary: missed optimization: recognize fnabs (FP negative
absolute value) (x86-64)
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Ouch - 32 bytes of constant pool data to turn on a single bit.
Using llc built from r214897:
$ cat fnabs.c
#include <math.h>
float foo(float a) {
return -fabs(a);
}
or in LLVM IR:
$ cat fnabs.ll
define float @foo(float %a) {
%fabsf = tail call float @fabsf(float %a) #1
%fsub = fsub float -0.0, %fabsf
ret float %fsub
}
declare float @fabsf(float)
attributes #1 = { readnone }
$ ./llc -mtriple=x86_64-unknown-unknown fnabs.ll -o -
.text
.file "fnabs.ll"
.section .rodata.cst16,"aM", at progbits,16
.align 16
.LCPI0_0:
.long 2147483647 # float nan
.long 2147483647 # float nan
.long 2147483647 # float nan
.long 2147483647 # float nan
.LCPI0_1:
.long 2147483648 # float -0.000000e+00
.long 2147483648 # float -0.000000e+00
.long 2147483648 # float -0.000000e+00
.long 2147483648 # float -0.000000e+00
.text
.globl foo
.align 16, 0x90
.type foo, at function
foo: # @foo
.cfi_startproc
# BB#0:
andps .LCPI0_0(%rip), %xmm0
xorps .LCPI0_1(%rip), %xmm0
retq
--
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/20140807/5de57803/attachment.html>
More information about the llvm-bugs
mailing list