1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 define double @std_cabs(double %real, double %imag) {
5 ; CHECK-LABEL: @std_cabs(
6 ; CHECK-NEXT: [[CALL:%.*]] = tail call double @cabs(double [[REAL:%.*]], double [[IMAG:%.*]])
7 ; CHECK-NEXT: ret double [[CALL]]
9 %call = tail call double @cabs(double %real, double %imag)
13 define float @std_cabsf(float %real, float %imag) {
14 ; CHECK-LABEL: @std_cabsf(
15 ; CHECK-NEXT: [[CALL:%.*]] = tail call float @cabsf(float [[REAL:%.*]], float [[IMAG:%.*]])
16 ; CHECK-NEXT: ret float [[CALL]]
18 %call = tail call float @cabsf(float %real, float %imag)
22 define fp128 @std_cabsl(fp128 %real, fp128 %imag) {
23 ; CHECK-LABEL: @std_cabsl(
24 ; CHECK-NEXT: [[CALL:%.*]] = tail call fp128 @cabsl(fp128 [[REAL:%.*]], fp128 [[IMAG:%.*]])
25 ; CHECK-NEXT: ret fp128 [[CALL]]
27 %call = tail call fp128 @cabsl(fp128 %real, fp128 %imag)
31 define double @fast_cabs(double %real, double %imag) {
32 ; CHECK-LABEL: @fast_cabs(
33 ; CHECK-NEXT: [[TMP1:%.*]] = fmul fast double [[REAL:%.*]], [[REAL]]
34 ; CHECK-NEXT: [[TMP2:%.*]] = fmul fast double [[IMAG:%.*]], [[IMAG]]
35 ; CHECK-NEXT: [[TMP3:%.*]] = fadd fast double [[TMP1]], [[TMP2]]
36 ; CHECK-NEXT: [[CABS:%.*]] = call fast double @llvm.sqrt.f64(double [[TMP3]])
37 ; CHECK-NEXT: ret double [[CABS]]
39 %call = tail call fast double @cabs(double %real, double %imag)
43 define float @fast_cabsf(float %real, float %imag) {
44 ; CHECK-LABEL: @fast_cabsf(
45 ; CHECK-NEXT: [[TMP1:%.*]] = fmul fast float [[REAL:%.*]], [[REAL]]
46 ; CHECK-NEXT: [[TMP2:%.*]] = fmul fast float [[IMAG:%.*]], [[IMAG]]
47 ; CHECK-NEXT: [[TMP3:%.*]] = fadd fast float [[TMP1]], [[TMP2]]
48 ; CHECK-NEXT: [[CABS:%.*]] = call fast float @llvm.sqrt.f32(float [[TMP3]])
49 ; CHECK-NEXT: ret float [[CABS]]
51 %call = tail call fast float @cabsf(float %real, float %imag)
55 define fp128 @fast_cabsl(fp128 %real, fp128 %imag) {
56 ; CHECK-LABEL: @fast_cabsl(
57 ; CHECK-NEXT: [[TMP1:%.*]] = fmul fast fp128 [[REAL:%.*]], [[REAL]]
58 ; CHECK-NEXT: [[TMP2:%.*]] = fmul fast fp128 [[IMAG:%.*]], [[IMAG]]
59 ; CHECK-NEXT: [[TMP3:%.*]] = fadd fast fp128 [[TMP1]], [[TMP2]]
60 ; CHECK-NEXT: [[CABS:%.*]] = call fast fp128 @llvm.sqrt.f128(fp128 [[TMP3]])
61 ; CHECK-NEXT: ret fp128 [[CABS]]
63 %call = tail call fast fp128 @cabsl(fp128 %real, fp128 %imag)
67 declare double @cabs(double %real, double %imag)
68 declare float @cabsf(float %real, float %imag)
69 declare fp128 @cabsl(fp128 %real, fp128 %imag)