1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -reassociate < %s | FileCheck %s
3
4; Check that if constants combine to an absorbing value then the expression is
5; evaluated as the absorbing value.
6
7define i8 @or_all_ones(i8 %x) {
8; CHECK-LABEL: @or_all_ones(
9; CHECK-NEXT:    ret i8 -1
10;
11  %tmp1 = or i8 %x, 127
12  %tmp2 = or i8 %tmp1, 128
13  ret i8 %tmp2
14}
15
16; TODO: fmul by 0.0 with nsz+nnan should have simplified to 0.0.
17
18define double @fmul_zero(double %x) {
19; CHECK-LABEL: @fmul_zero(
20; CHECK-NEXT:    [[R:%.*]] = fmul fast double [[X:%.*]], 0.000000e+00
21; CHECK-NEXT:    ret double [[R]]
22;
23  %x4 = fmul fast double %x, 4.0
24  %r = fmul fast double %x4, 0.0
25  ret double %r
26}
27
28