xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/cos-2.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare float @cos(double)
6*9880d681SAndroid Build Coastguard Workerdeclare signext i8 @sqrt(...)
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; Check that functions with the wrong prototype aren't simplified.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine float @test_no_simplify1(double %d) {
11*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_no_simplify1(
12*9880d681SAndroid Build Coastguard Worker  %neg = fsub double -0.000000e+00, %d
13*9880d681SAndroid Build Coastguard Worker  %cos = call float @cos(double %neg)
14*9880d681SAndroid Build Coastguard Worker; CHECK: call float @cos(double %neg)
15*9880d681SAndroid Build Coastguard Worker  ret float %cos
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine i8 @bogus_sqrt() {
20*9880d681SAndroid Build Coastguard Worker  %fake_sqrt = call signext i8 (...) @sqrt()
21*9880d681SAndroid Build Coastguard Worker  ret i8 %fake_sqrt
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: bogus_sqrt(
24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  %fake_sqrt = call signext i8 (...) @sqrt()
25*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret i8 %fake_sqrt
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28