# Changeset View

Changeset View

# Standalone View

Standalone View

# llvm/trunk/test/Transforms/InstSimplify/fast-math.ll

Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||

51 | ; CHECK-NEXT: ret float [[B]] | 51 | ; CHECK-NEXT: ret float [[B]] | ||

52 | ; | 52 | ; | ||

53 | %b = fmul float %a, 0.0 | 53 | %b = fmul float %a, 0.0 | ||

54 | ret float %b | 54 | ret float %b | ||

55 | } | 55 | } | ||

56 | 56 | | |||

57 | ; -X + X --> 0.0 (with nnan on the fadd) | 57 | ; -X + X --> 0.0 (with nnan on the fadd) | ||

58 | 58 | | |||

59 | define float @fadd_fnegx(float %x) { | 59 | define float @fadd_binary_fnegx(float %x) { | ||

60 | ; CHECK-LABEL: @fadd_fnegx( | 60 | ; CHECK-LABEL: @fadd_binary_fnegx( | ||

61 | ; CHECK-NEXT: ret float 0.000000e+00 | 61 | ; CHECK-NEXT: ret float 0.000000e+00 | ||

62 | ; | 62 | ; | ||

63 | %negx = fsub float -0.0, %x | 63 | %negx = fsub float -0.0, %x | ||

64 | %r = fadd nnan float %negx, %x | 64 | %r = fadd nnan float %negx, %x | ||

65 | ret float %r | 65 | ret float %r | ||

66 | } | 66 | } | ||

67 | 67 | | |||

68 | define float @fadd_unary_fnegx(float %x) { | ||||

69 | ; CHECK-LABEL: @fadd_unary_fnegx( | ||||

70 | ; CHECK-NEXT: ret float 0.000000e+00 | ||||

71 | ; | ||||

72 | %negx = fneg float %x | ||||

73 | %r = fadd nnan float %negx, %x | ||||

74 | ret float %r | ||||

75 | } | ||||

76 | | ||||

68 | ; X + -X --> 0.0 (with nnan on the fadd) | 77 | ; X + -X --> 0.0 (with nnan on the fadd) | ||

69 | 78 | | |||

70 | define <2 x float> @fadd_fnegx_commute_vec(<2 x float> %x) { | 79 | define <2 x float> @fadd_binary_fnegx_commute_vec(<2 x float> %x) { | ||

71 | ; CHECK-LABEL: @fadd_fnegx_commute_vec( | 80 | ; CHECK-LABEL: @fadd_binary_fnegx_commute_vec( | ||

72 | ; CHECK-NEXT: ret <2 x float> zeroinitializer | 81 | ; CHECK-NEXT: ret <2 x float> zeroinitializer | ||

73 | ; | 82 | ; | ||

74 | %negx = fsub <2 x float> <float -0.0, float -0.0>, %x | 83 | %negx = fsub <2 x float> <float -0.0, float -0.0>, %x | ||

75 | %r = fadd nnan <2 x float> %x, %negx | 84 | %r = fadd nnan <2 x float> %x, %negx | ||

76 | ret <2 x float> %r | 85 | ret <2 x float> %r | ||

77 | } | 86 | } | ||

78 | 87 | | |||

88 | define <2 x float> @fadd_unary_fnegx_commute_vec(<2 x float> %x) { | ||||

89 | ; CHECK-LABEL: @fadd_unary_fnegx_commute_vec( | ||||

90 | ; CHECK-NEXT: ret <2 x float> zeroinitializer | ||||

91 | ; | ||||

92 | %negx = fneg <2 x float> %x | ||||

93 | %r = fadd nnan <2 x float> %x, %negx | ||||

94 | ret <2 x float> %r | ||||

95 | } | ||||

96 | | ||||

79 | define <2 x float> @fadd_fnegx_commute_vec_undef(<2 x float> %x) { | 97 | define <2 x float> @fadd_fnegx_commute_vec_undef(<2 x float> %x) { | ||

80 | ; CHECK-LABEL: @fadd_fnegx_commute_vec_undef( | 98 | ; CHECK-LABEL: @fadd_fnegx_commute_vec_undef( | ||

81 | ; CHECK-NEXT: ret <2 x float> zeroinitializer | 99 | ; CHECK-NEXT: ret <2 x float> zeroinitializer | ||

82 | ; | 100 | ; | ||

83 | %negx = fsub <2 x float> <float undef, float -0.0>, %x | 101 | %negx = fsub <2 x float> <float undef, float -0.0>, %x | ||

84 | %r = fadd nnan <2 x float> %x, %negx | 102 | %r = fadd nnan <2 x float> %x, %negx | ||

85 | ret <2 x float> %r | 103 | ret <2 x float> %r | ||

86 | } | 104 | } | ||

▲ Show 20 Lines • Show All 376 Lines • Show Last 20 Lines |