# Changeset View

Changeset View

# Standalone View

Standalone View

# llvm/test/Transforms/InstCombine/double-float-shrink-2.ll

1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
---|---|---|---|---|---|

2 | ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s | 2 | ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck %s | ||

3 | ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck --check-prefixes=CHECK,DONT-SIMPLIFY %s | 3 | ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck %s | ||

4 | ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck --check-prefixes=CHECK,C89-SIMPLIFY %s | 4 | ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck %s | ||

5 | ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s | 5 | ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck %s | ||

6 | ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s | 6 | ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck %s | ||

7 | ; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s | 7 | ; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck %s | ||

8 | ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 | FileCheck --check-prefix=DBG-VALID %s | 8 | ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 | FileCheck --check-prefix=DBG-VALID %s | ||

9 | 9 | | |||

10 | declare double @floor(double) | 10 | declare double @floor(double) | ||

Context not available. | |||||

61 | 61 | | |||

62 | define float @test_shrink_libcall_round(float %C) { | 62 | define float @test_shrink_libcall_round(float %C) { | ||

63 | ; CHECK-LABEL: @test_shrink_libcall_round( | 63 | ; CHECK-LABEL: @test_shrink_libcall_round( | ||

64 | 64 | ; CHECK-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) | |||

65 | ; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) | 65 | ; CHECK-NEXT: ret float [[F]] | ||

66 | ; DO-SIMPLIFY-NEXT: ret float [[F]] | | |||

67 | ; | | |||

68 | ; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double | | |||

69 | ; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]]) | | |||

70 | ; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float | | |||

71 | ; DONT-SIMPLIFY-NEXT: ret float [[F]] | | |||

72 | ; | | |||

73 | ; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double | | |||

74 | ; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]]) | | |||

75 | ; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float | | |||

76 | ; C89-SIMPLIFY-NEXT: ret float [[F]] | | |||

77 | ; | 66 | ; | ||

78 | %D = fpext float %C to double | 67 | %D = fpext float %C to double | ||

79 | ; --> roundf | 68 | ; --> roundf | ||

Context not available. | |||||

84 | 73 | | |||

85 | define float @test_shrink_libcall_nearbyint(float %C) { | 74 | define float @test_shrink_libcall_nearbyint(float %C) { | ||

86 | ; CHECK-LABEL: @test_shrink_libcall_nearbyint( | 75 | ; CHECK-LABEL: @test_shrink_libcall_nearbyint( | ||

87 | 76 | ; CHECK-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) | |||

88 | ; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) | 77 | ; CHECK-NEXT: ret float [[F]] | ||

89 | ; DO-SIMPLIFY-NEXT: ret float [[F]] | | |||

90 | ; | | |||

91 | ; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double | | |||

92 | ; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]]) | | |||

93 | ; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float | | |||

94 | ; DONT-SIMPLIFY-NEXT: ret float [[F]] | | |||

95 | ; | | |||

96 | ; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double | | |||

97 | ; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]]) | | |||

98 | ; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float | | |||

99 | ; C89-SIMPLIFY-NEXT: ret float [[F]] | | |||

100 | ; | 78 | ; | ||

101 | %D = fpext float %C to double | 79 | %D = fpext float %C to double | ||

102 | ; --> nearbyintf | 80 | ; --> nearbyintf | ||

Context not available. | |||||

107 | 85 | | |||

108 | define float @test_shrink_libcall_trunc(float %C) { | 86 | define float @test_shrink_libcall_trunc(float %C) { | ||

109 | ; CHECK-LABEL: @test_shrink_libcall_trunc( | 87 | ; CHECK-LABEL: @test_shrink_libcall_trunc( | ||

110 | 88 | ; CHECK-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) | |||

111 | ; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) | 89 | ; CHECK-NEXT: ret float [[F]] | ||

112 | ; DO-SIMPLIFY-NEXT: ret float [[F]] | | |||

113 | ; | | |||

114 | ; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double | | |||

115 | ; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]]) | | |||

116 | ; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float | | |||

117 | ; DONT-SIMPLIFY-NEXT: ret float [[F]] | | |||

118 | ; | | |||

119 | ; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double | | |||

120 | ; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]]) | | |||

121 | ; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float | | |||

122 | ; C89-SIMPLIFY-NEXT: ret float [[F]] | | |||

123 | ; | 90 | ; | ||

124 | %D = fpext float %C to double | 91 | %D = fpext float %C to double | ||

125 | ; --> truncf | 92 | ; --> truncf | ||

Context not available. |