llvm.org GIT mirror llvm / 8567853
[Reassociate] add test for missing FP constant analysis; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336208 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 1 year, 2 months ago
1 changed file(s) with 19 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt -S -reassociate < %s | FileCheck %s
12
23 ; Check that if constants combine to an absorbing value then the expression is
34 ; evaluated as the absorbing value.
4 define i8 @foo(i8 %x) {
5
6 define i8 @or_all_ones(i8 %x) {
7 ; CHECK-LABEL: @or_all_ones(
8 ; CHECK-NEXT: ret i8 -1
9 ;
510 %tmp1 = or i8 %x, 127
611 %tmp2 = or i8 %tmp1, 128
712 ret i8 %tmp2
8 ; CHECK-LABEL: @foo(
9 ; CHECK: ret i8 -1
1013 }
14
15 ; TODO: fmul by 0.0 with nsz+nnan should have simplified to 0.0.
16
17 define double @fmul_zero(double %x) {
18 ; CHECK-LABEL: @fmul_zero(
19 ; CHECK-NEXT: [[R:%.*]] = fmul fast double [[X:%.*]], 0.000000e+00
20 ; CHECK-NEXT: ret double [[R]]
21 ;
22 %x4 = fmul fast double %x, 4.0
23 %r = fmul fast double %x4, 0.0
24 ret double %r
25 }
26