1 ; RUN: opt < %s -instsimplify -S | FileCheck %s
3 ; fsub 0, (fsub 0, X) ==> X
4 ; CHECK-LABEL: @fsub_0_0_x(
5 define float @fsub_0_0_x(float %a) {
6 %t1 = fsub float -0.0, %a
7 %ret = fsub float -0.0, %t1
14 ; CHECK-LABEL: @fsub_x_0(
15 define float @fsub_x_0(float %a) {
16 %ret = fsub float %a, 0.0
22 ; CHECK-LABEL: @fadd_x_n0(
23 define float @fadd_x_n0(float %a) {
24 %ret = fadd float %a, -0.0
30 ; CHECK-LABEL: @fmul_X_1(
31 define double @fmul_X_1(double %a) {
32 %b = fmul double 1.000000e+00, %a ; <double> [#uses=1]
33 ; CHECK: ret double %a
37 ; We can't optimize away the fadd in this test because the input
38 ; value to the function and subsequently to the fadd may be -0.0.
39 ; In that one special case, the result of the fadd should be +0.0
40 ; rather than the first parameter of the fadd.
42 ; Fragile test warning: We need 6 sqrt calls to trigger the bug
43 ; because the internal logic has a magic recursion limit of 6.
44 ; This is presented without any explanation or ability to customize.
46 declare float @sqrtf(float)
48 define float @PR22688(float %x) {
49 %1 = call float @sqrtf(float %x)
50 %2 = call float @sqrtf(float %1)
51 %3 = call float @sqrtf(float %2)
52 %4 = call float @sqrtf(float %3)
53 %5 = call float @sqrtf(float %4)
54 %6 = call float @sqrtf(float %5)
55 %7 = fadd float %6, 0.0
58 ; CHECK-LABEL: @PR22688(
59 ; CHECK: fadd float %6, 0.0