From f141d1afc5068d5c5e2c47e25a5d4b4914116b92 Mon Sep 17 00:00:00 2001 From: Qiu Chaofan Date: Wed, 16 Dec 2020 17:19:54 +0800 Subject: [PATCH 1/3] [NFC] Pre-commit test for long-double builtins This test reflects clang behavior on long-double type math library builtins under default or explicit 128-bit long-double options. --- clang/test/CodeGen/math-builtins-long.c | 371 ++++++++++++++++++++++++ 1 file changed, 371 insertions(+) create mode 100644 clang/test/CodeGen/math-builtins-long.c diff --git a/clang/test/CodeGen/math-builtins-long.c b/clang/test/CodeGen/math-builtins-long.c new file mode 100644 index 0000000000000..bf7ebd3144449 --- /dev/null +++ b/clang/test/CodeGen/math-builtins-long.c @@ -0,0 +1,371 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s \ +// RUN: -fmath-errno | FileCheck %s -check-prefix=F80 +// RUN: %clang_cc1 -triple ppc64le-unknown-unknown -w -S -o - -emit-llvm %s \ +// RUN: -fmath-errno | FileCheck %s -check-prefix=PPC +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -mlong-double-128 -w -S \ +// RUN: -o - -emit-llvm %s -fmath-errno | FileCheck %s -check-prefix=X86F128 +// RUN: %clang_cc1 -triple ppc64le-unknown-unknown -mabi=ieeelongdouble -w -S \ +// RUN: -o - -emit-llvm %s -fmath-errno | FileCheck %s -check-prefix=PPCF128 + +void bar(long double); + +void foo(long double f, long double *l, int *i, const char *c) { + // F80: call x86_fp80 @fmodl(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @fmodl(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @fmodl(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @fmodl(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_fmodl(f,f); + + // F80: call x86_fp80 @atan2l(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @atan2l(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @atan2l(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @atan2l(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_atan2l(f,f); + + // F80: call x86_fp80 @llvm.copysign.f80(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.copysign.ppcf128(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.copysign.f128(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.copysign.f128(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_copysignl(f,f); + + // F80: call x86_fp80 @llvm.fabs.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.fabs.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.fabs.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.fabs.f128(fp128 %{{.+}}) + __builtin_fabsl(f); + + // F80: call x86_fp80 @frexpl(x86_fp80 %{{.+}}, i32* %{{.+}}) + // PPC: call ppc_fp128 @frexpl(ppc_fp128 %{{.+}}, i32* %{{.+}}) + // X86F128: call fp128 @frexpl(fp128 %{{.+}}, i32* %{{.+}}) + // PPCF128: call fp128 @frexpl(fp128 %{{.+}}, i32* %{{.+}}) + __builtin_frexpl(f,i); + + // F80: store x86_fp80 0xK7FFF8000000000000000, x86_fp80* + // PPC: store ppc_fp128 0xM7FF00000000000000000000000000000, ppc_fp128* + // X86F128: store fp128 0xL00000000000000007FFF000000000000, fp128* + // PPCF128: store fp128 0xL00000000000000007FFF000000000000, fp128* + *l = __builtin_huge_vall(); + + // F80: store x86_fp80 0xK7FFF8000000000000000, x86_fp80* + // PPC: store ppc_fp128 0xM7FF00000000000000000000000000000, ppc_fp128* + // X86F128: store fp128 0xL00000000000000007FFF000000000000, fp128* + // PPCF128: store fp128 0xL00000000000000007FFF000000000000, fp128* + *l = __builtin_infl(); + + // F80: call x86_fp80 @ldexpl(x86_fp80 %{{.+}}, i32 %{{.+}}) + // PPC: call ppc_fp128 @ldexpl(ppc_fp128 %{{.+}}, {{(signext)?.+}}) + // X86F128: call fp128 @ldexpl(fp128 %{{.+}}, {{(signext)?.+}}) + // PPCF128: call fp128 @ldexpl(fp128 %{{.+}}, {{(signext)?.+}}) + __builtin_ldexpl(f,f); + + // F80: call x86_fp80 @modfl(x86_fp80 %{{.+}}, x86_fp80* %{{.+}}) + // PPC: call ppc_fp128 @modfl(ppc_fp128 %{{.+}}, ppc_fp128* %{{.+}}) + // X86F128: call fp128 @modfl(fp128 %{{.+}}, fp128* %{{.+}}) + // PPCF128: call fp128 @modfl(fp128 %{{.+}}, fp128* %{{.+}}) + __builtin_modfl(f,l); + + // F80: call x86_fp80 @nanl(i8* %{{.+}}) + // PPC: call ppc_fp128 @nanl(i8* %{{.+}}) + // X86F128: call fp128 @nanl(i8* %{{.+}}) + // PPCF128: call fp128 @nanl(i8* %{{.+}}) + __builtin_nanl(c); + + // F80: call x86_fp80 @nansl(i8* %{{.+}}) + // PPC: call ppc_fp128 @nansl(i8* %{{.+}}) + // X86F128: call fp128 @nansl(i8* %{{.+}}) + // PPCF128: call fp128 @nansl(i8* %{{.+}}) + __builtin_nansl(c); + + // F80: call x86_fp80 @powl(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @powl(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @powl(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @powl(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_powl(f,f); + + // F80: call x86_fp80 @acosl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @acosl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @acosl(fp128 %{{.+}}) + // PPCF128: call fp128 @acosl(fp128 %{{.+}}) + __builtin_acosl(f); + + // F80: call x86_fp80 @acoshl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @acoshl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @acoshl(fp128 %{{.+}}) + // PPCF128: call fp128 @acoshl(fp128 %{{.+}}) + __builtin_acoshl(f); + + // F80: call x86_fp80 @asinl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @asinl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @asinl(fp128 %{{.+}}) + // PPCF128: call fp128 @asinl(fp128 %{{.+}}) + __builtin_asinl(f); + + // F80: call x86_fp80 @asinhl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @asinhl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @asinhl(fp128 %{{.+}}) + // PPCF128: call fp128 @asinhl(fp128 %{{.+}}) + __builtin_asinhl(f); + + // F80: call x86_fp80 @atanl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @atanl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @atanl(fp128 %{{.+}}) + // PPCF128: call fp128 @atanl(fp128 %{{.+}}) + __builtin_atanl(f); + + // F80: call x86_fp80 @atanhl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @atanhl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @atanhl(fp128 %{{.+}}) + // PPCF128: call fp128 @atanhl(fp128 %{{.+}}) + __builtin_atanhl(f); + + // F80: call x86_fp80 @cbrtl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @cbrtl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @cbrtl(fp128 %{{.+}}) + // PPCF128: call fp128 @cbrtl(fp128 %{{.+}}) + __builtin_cbrtl(f); + + // F80: call x86_fp80 @llvm.ceil.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.ceil.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.ceil.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.ceil.f128(fp128 %{{.+}}) + __builtin_ceill(f); + + // F80: call x86_fp80 @cosl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @cosl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @cosl(fp128 %{{.+}}) + // PPCF128: call fp128 @cosl(fp128 %{{.+}}) + __builtin_cosl(f); + + // F80: call x86_fp80 @coshl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @coshl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @coshl(fp128 %{{.+}}) + // PPCF128: call fp128 @coshl(fp128 %{{.+}}) + __builtin_coshl(f); + + // F80: call x86_fp80 @llvm.floor.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.floor.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.floor.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.floor.f128(fp128 %{{.+}}) + __builtin_floorl(f); + + // F80: call x86_fp80 @llvm.maxnum.f80(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.maxnum.ppcf128(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.maxnum.f128(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.maxnum.f128(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_fmaxl(f,f); + + // F80: call x86_fp80 @llvm.minnum.f80(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.minnum.ppcf128(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.minnum.f128(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.minnum.f128(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_fminl(f,f); + + // F80: call x86_fp80 @llvm.nearbyint.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.nearbyint.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.nearbyint.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.nearbyint.f128(fp128 %{{.+}}) + __builtin_nearbyintl(f); + + // F80: call x86_fp80 @llvm.trunc.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.trunc.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.trunc.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.trunc.f128(fp128 %{{.+}}) + __builtin_truncl(f); + + // F80: call x86_fp80 @llvm.rint.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.rint.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.rint.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.rint.f128(fp128 %{{.+}}) + __builtin_rintl(f); + + // F80: call x86_fp80 @llvm.round.f80(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @llvm.round.ppcf128(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @llvm.round.f128(fp128 %{{.+}}) + // PPCF128: call fp128 @llvm.round.f128(fp128 %{{.+}}) + __builtin_roundl(f); + // F80: call x86_fp80 @erfl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @erfl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @erfl(fp128 %{{.+}}) + // PPCF128: call fp128 @erfl(fp128 %{{.+}}) + __builtin_erfl(f); + + // F80: call x86_fp80 @erfcl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @erfcl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @erfcl(fp128 %{{.+}}) + // PPCF128: call fp128 @erfcl(fp128 %{{.+}}) + __builtin_erfcl(f); + + // F80: call x86_fp80 @expl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @expl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @expl(fp128 %{{.+}}) + // PPCF128: call fp128 @expl(fp128 %{{.+}}) + __builtin_expl(f); + + // F80: call x86_fp80 @exp2l(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @exp2l(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @exp2l(fp128 %{{.+}}) + // PPCF128: call fp128 @exp2l(fp128 %{{.+}}) + __builtin_exp2l(f); + + // F80: call x86_fp80 @expm1l(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @expm1l(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @expm1l(fp128 %{{.+}}) + // PPCF128: call fp128 @expm1l(fp128 %{{.+}}) + __builtin_expm1l(f); + + // F80: call x86_fp80 @fdiml(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @fdiml(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @fdiml(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @fdiml(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_fdiml(f,f); + + // F80: call x86_fp80 @fmal(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @fmal(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @fmal(fp128 %{{.+}}, fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @fmal(fp128 %{{.+}}, fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_fmal(f,f,f); + + // F80: call x86_fp80 @hypotl(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @hypotl(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @hypotl(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @hypotl(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_hypotl(f,f); + + // F80: call i32 @ilogbl(x86_fp80 %{{.+}}) + // PPC: call {{(i32)|(signext i32)}} @ilogbl(ppc_fp128 %{{.+}}) + // X86F128: call {{(i32)|(signext i32)}} @ilogbl(fp128 %{{.+}}) + // PPCF128: call {{(i32)|(signext i32)}} @ilogbl(fp128 %{{.+}}) + __builtin_ilogbl(f); + + // F80: call x86_fp80 @lgammal(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @lgammal(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @lgammal(fp128 %{{.+}}) + // PPCF128: call fp128 @lgammal(fp128 %{{.+}}) + __builtin_lgammal(f); + + // F80: call i64 @llrintl(x86_fp80 %{{.+}}) + // PPC: call i64 @llrintl(ppc_fp128 %{{.+}}) + // X86F128: call i64 @llrintl(fp128 %{{.+}}) + // PPCF128: call i64 @llrintl(fp128 %{{.+}}) + __builtin_llrintl(f); + + // F80: call i64 @llroundl(x86_fp80 %{{.+}}) + // PPC: call i64 @llroundl(ppc_fp128 %{{.+}}) + // X86F128: call i64 @llroundl(fp128 %{{.+}}) + // PPCF128: call i64 @llroundl(fp128 %{{.+}}) + __builtin_llroundl(f); + + // F80: call x86_fp80 @logl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @logl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @logl(fp128 %{{.+}}) + // PPCF128: call fp128 @logl(fp128 %{{.+}}) + __builtin_logl(f); + + // F80: call x86_fp80 @log10l(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @log10l(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @log10l(fp128 %{{.+}}) + // PPCF128: call fp128 @log10l(fp128 %{{.+}}) + __builtin_log10l(f); + + // F80: call x86_fp80 @log1pl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @log1pl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @log1pl(fp128 %{{.+}}) + // PPCF128: call fp128 @log1pl(fp128 %{{.+}}) + __builtin_log1pl(f); + + // F80: call x86_fp80 @log2l(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @log2l(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @log2l(fp128 %{{.+}}) + // PPCF128: call fp128 @log2l(fp128 %{{.+}}) + __builtin_log2l(f); + + // F80: call x86_fp80 @logbl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @logbl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @logbl(fp128 %{{.+}}) + // PPCF128: call fp128 @logbl(fp128 %{{.+}}) + __builtin_logbl(f); + + // F80: call i64 @lrintl(x86_fp80 %{{.+}}) + // PPC: call i64 @lrintl(ppc_fp128 %{{.+}}) + // X86F128: call i64 @lrintl(fp128 %{{.+}}) + // PPCF128: call i64 @lrintl(fp128 %{{.+}}) + __builtin_lrintl(f); + + // F80: call i64 @lroundl(x86_fp80 %{{.+}}) + // PPC: call i64 @lroundl(ppc_fp128 %{{.+}}) + // X86F128: call i64 @lroundl(fp128 %{{.+}}) + // PPCF128: call i64 @lroundl(fp128 %{{.+}}) + __builtin_lroundl(f); + + // F80: call x86_fp80 @nextafterl(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @nextafterl(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @nextafterl(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @nextafterl(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_nextafterl(f,f); + + // F80: call x86_fp80 @nexttowardl(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @nexttowardl(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @nexttowardl(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @nexttowardl(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_nexttowardl(f,f); + + // F80: call x86_fp80 @remainderl(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @remainderl(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}) + // X86F128: call fp128 @remainderl(fp128 %{{.+}}, fp128 %{{.+}}) + // PPCF128: call fp128 @remainderl(fp128 %{{.+}}, fp128 %{{.+}}) + __builtin_remainderl(f,f); + + // F80: call x86_fp80 @remquol(x86_fp80 %{{.+}}, x86_fp80 %{{.+}}, i32* %{{.+}}) + // PPC: call ppc_fp128 @remquol(ppc_fp128 %{{.+}}, ppc_fp128 %{{.+}}, i32* %{{.+}}) + // X86F128: call fp128 @remquol(fp128 %{{.+}}, fp128 %{{.+}}, i32* %{{.+}}) + // PPCF128: call fp128 @remquol(fp128 %{{.+}}, fp128 %{{.+}}, i32* %{{.+}}) + __builtin_remquol(f,f,i); + + // F80: call x86_fp80 @scalblnl(x86_fp80 %{{.+}}, i64 %{{.+}}) + // PPC: call ppc_fp128 @scalblnl(ppc_fp128 %{{.+}}, i64 %{{.+}}) + // X86F128: call fp128 @scalblnl(fp128 %{{.+}}, i64 %{{.+}}) + // PPCF128: call fp128 @scalblnl(fp128 %{{.+}}, i64 %{{.+}}) + __builtin_scalblnl(f,f); + + // F80: call x86_fp80 @scalbnl(x86_fp80 %{{.+}}, i32 %{{.+}}) + // PPC: call ppc_fp128 @scalbnl(ppc_fp128 %{{.+}}, {{(signext)?.+}}) + // X86F128: call fp128 @scalbnl(fp128 %{{.+}}, {{(signext)?.+}}) + // PPCF128: call fp128 @scalbnl(fp128 %{{.+}}, {{(signext)?.+}}) + __builtin_scalbnl(f,f); + + // F80: call x86_fp80 @sinl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @sinl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @sinl(fp128 %{{.+}}) + // PPCF128: call fp128 @sinl(fp128 %{{.+}}) + __builtin_sinl(f); + + // F80: call x86_fp80 @sinhl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @sinhl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @sinhl(fp128 %{{.+}}) + // PPCF128: call fp128 @sinhl(fp128 %{{.+}}) + __builtin_sinhl(f); + + // F80: call x86_fp80 @sqrtl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @sqrtl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @sqrtl(fp128 %{{.+}}) + // PPCF128: call fp128 @sqrtl(fp128 %{{.+}}) + __builtin_sqrtl(f); + + // F80: call x86_fp80 @tanl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @tanl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @tanl(fp128 %{{.+}}) + // PPCF128: call fp128 @tanl(fp128 %{{.+}}) + __builtin_tanl(f); + + // F80: call x86_fp80 @tanhl(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @tanhl(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @tanhl(fp128 %{{.+}}) + // PPCF128: call fp128 @tanhl(fp128 %{{.+}}) + __builtin_tanhl(f); + + // F80: call x86_fp80 @tgammal(x86_fp80 %{{.+}}) + // PPC: call ppc_fp128 @tgammal(ppc_fp128 %{{.+}}) + // X86F128: call fp128 @tgammal(fp128 %{{.+}}) + // PPCF128: call fp128 @tgammal(fp128 %{{.+}}) + __builtin_tgammal(f); +} From c7afb698caf00f0ad0b479f7d2869c119aa3482e Mon Sep 17 00:00:00 2001 From: Piotr Sobczak Date: Wed, 16 Dec 2020 10:12:54 +0100 Subject: [PATCH 2/3] [AMDGPU] Avoid calling copyFastMathFlags in wrong context Calling Instruction::copyFastMathFlags() assumes the caller is FPMathOperator. Avoid calling the function for instructions that are not instances of FPMathOperator. --- llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp index 59c852b01d8bf..b668c9d1d56f5 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp @@ -159,7 +159,8 @@ simplifyAMDGCNImageIntrinsic(const GCNSubtarget *ST, CallInst *NewCall = IC.Builder.CreateCall(I, Args); NewCall->takeName(&II); NewCall->copyMetadata(II); - NewCall->copyFastMathFlags(&II); + if (isa(NewCall)) + NewCall->copyFastMathFlags(&II); return IC.replaceInstUsesWith(II, NewCall); } From 0da240c2d050303c99564f1901b0d1548ffe2323 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 15 Dec 2020 13:08:04 +0100 Subject: [PATCH 3/3] [clang][cli] Port DependencyOutput string based options to new option parsing system Depends on D84186 Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D84187 --- clang/include/clang/Driver/Options.td | 12 ++++++++---- clang/lib/Frontend/CompilerInvocation.cpp | 6 ------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 76deb9de708bb..dd23d810e3881 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -960,11 +960,14 @@ def dM : Flag<["-"], "dM">, Group, Flags<[CC1Option]>, HelpText<"Print macro definitions in -E mode instead of normal output">; def dead__strip : Flag<["-"], "dead_strip">; def dependency_file : Separate<["-"], "dependency-file">, Flags<[CC1Option]>, - HelpText<"Filename (or -) to write dependency output to">; + HelpText<"Filename (or -) to write dependency output to">, + MarshallingInfoString<"DependencyOutputOpts.OutputFile">; def dependency_dot : Separate<["-"], "dependency-dot">, Flags<[CC1Option]>, - HelpText<"Filename to write DOT-formatted header dependencies to">; + HelpText<"Filename to write DOT-formatted header dependencies to">, + MarshallingInfoString<"DependencyOutputOpts.DOTOutputFile">; def module_dependency_dir : Separate<["-"], "module-dependency-dir">, - Flags<[CC1Option]>, HelpText<"Directory to dump module dependencies to">; + Flags<[CC1Option]>, HelpText<"Directory to dump module dependencies to">, + MarshallingInfoString<"DependencyOutputOpts.ModuleDependencyOutputDir">; def dsym_dir : JoinedOrSeparate<["-"], "dsym-dir">, Flags<[NoXarchOption, RenderAsInput]>, HelpText<"Directory to output dSYM's (if any) to">, MetaVarName<"">; @@ -4514,7 +4517,8 @@ def module_file_deps : Flag<["-"], "module-file-deps">, HelpText<"Include module files in dependency output">, MarshallingInfoFlag<"DependencyOutputOpts.IncludeModuleFiles">; def header_include_file : Separate<["-"], "header-include-file">, - HelpText<"Filename (or -) to write header include output to">; + HelpText<"Filename (or -) to write header include output to">, + MarshallingInfoString<"DependencyOutputOpts.HeaderIncludeOutputFile">; def show_includes : Flag<["--"], "show-includes">, HelpText<"Print cl.exe style /showIncludes to stdout">; diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 2d6cb3bb878f5..5fbafa3b2583d 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1447,10 +1447,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, ArgList &Args) { - Opts.OutputFile = std::string(Args.getLastArgValue(OPT_dependency_file)); Opts.Targets = Args.getAllArgValues(OPT_MT); - Opts.HeaderIncludeOutputFile = - std::string(Args.getLastArgValue(OPT_header_include_file)); if (Args.hasArg(OPT_show_includes)) { // Writing both /showIncludes and preprocessor output to stdout // would produce interleaved output, so use stderr for /showIncludes. @@ -1462,9 +1459,6 @@ static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, } else { Opts.ShowIncludesDest = ShowIncludesDestination::None; } - Opts.DOTOutputFile = std::string(Args.getLastArgValue(OPT_dependency_dot)); - Opts.ModuleDependencyOutputDir = - std::string(Args.getLastArgValue(OPT_module_dependency_dir)); // Add sanitizer blacklists as extra dependencies. // They won't be discovered by the regular preprocessor, so // we let make / ninja to know about this implicit dependency.