blob: 0c6fd3ab5693d2503be6ee7e56201ffbd7449cbf [file] [log] [blame]
Chad Rosierbd64d462014-10-09 20:06:29 +00001; RUN: opt -reassociate -S < %s | FileCheck %s
2; PR21205
3
4@a = common global i32 0, align 4
5@b = common global i32 0, align 4
6
7; Don't canonicalize %conv - undef into %conv + (-undef).
8; CHECK-LABEL: @test1
9; CHECK: %sub = fsub fast float %conv, undef
10; CHECK: %sub1 = fadd fast float %sub, -1.000000e+00
11
12define i32 @test1() {
13entry:
David Blaikiea79ac142015-02-27 21:17:42 +000014 %0 = load i32, i32* @a, align 4
Chad Rosierbd64d462014-10-09 20:06:29 +000015 %conv = sitofp i32 %0 to float
16 %sub = fsub fast float %conv, undef
17 %sub1 = fadd fast float %sub, -1.000000e+00
18 %conv2 = fptosi float %sub1 to i32
19 store i32 %conv2, i32* @b, align 4
20 ret i32 undef
21}