File: pr47517.ll

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (41 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple x86_64 < %s | FileCheck %s

; To ensure unused floating point constant is correctly removed
define float @test(float %src, float* %p) {
; CHECK-LABEL: test:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    movq $0, (%rdi)
; CHECK-NEXT:    xorps %xmm0, %xmm0
; CHECK-NEXT:    retq
entry:
  %a0 = getelementptr inbounds float, float* %p, i32 0
  %a1 = getelementptr inbounds float, float* %p, i32 1
  store float 0.000000e+00, float* %a0
  store float 0.000000e+00, float* %a1
  %zero = load float, float* %a0
  %fmul1 = fmul fast float %zero, %src
  %fadd1 = fadd fast float %fmul1, %zero
  %fmul2 = fmul fast float %fadd1, 2.000000e+00
  %fmul3 = fmul fast float %fmul2, %fmul2
  %fmul4 = fmul fast float %fmul2, 2.000000e+00
  %fadd2 = fadd fast float %fmul4, -3.000000e+00
  %fmul5 = fmul fast float %fadd2, %fmul2
  %fadd3 = fadd fast float %fmul2, %src
  %fadd4 = fadd fast float %fadd3, %fmul5
  %fmul6 = fmul fast float %fmul3, %fadd4
  ret float %fmul6
}

; To ensure negated result will not be removed when NegX=NegY and
; NegX is needed
define float @test2(float %x, float %y) {
  %add = fadd fast float %x, 750.0
  %sub = fsub fast float %x, %add
  %mul = fmul fast float %sub, %sub
  %mul2 = fmul fast float %mul, %sub
  %add2 = fadd fast float %mul2, 1.0
  %add3 = fadd fast float %mul2, %add2
  %mul3 = fmul fast float %y, %add3
  ret float %mul3
}