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: [email protected]
Reporter: [email protected]
CC: [email protected]
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",@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,@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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs