Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@ pub(crate) fn encode_ty<'tcx>(
FloatTy::F64 => "d",
FloatTy::F128 => match tcx.sess.target.arch {
Arch::PowerPC | Arch::PowerPC64 => "u9__ieee128", // "g" is used for __ibm128
// Clang is more friendly toward `long double`, and not all platforms support `_Float128`.
Arch::AArch64
if !tcx.sess.target.is_like_darwin && !tcx.sess.target.is_like_windows =>
{
"e"
}
Arch::RiscV32 | Arch::RiscV64 | Arch::LoongArch64 => "e",
_ => "g",
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Verifies `f128` maps to `long double` (code `e`) where that's 128-bit
// (aarch64 Linux) and to `_Float128` (code `g`) elsewhere (x86_64, and aarch64
// Apple where `long double` is 64-bit).
//
//@ add-minicore
//@ needs-sanitizer-cfi
//@ revisions: aarch64 x64 darwin loongarch64
//@ [aarch64] needs-llvm-components: aarch64
//@ [aarch64] compile-flags: --target aarch64-unknown-linux-gnu
//@ [x64] needs-llvm-components: x86
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu
//@ [darwin] needs-llvm-components: aarch64
//@ [darwin] compile-flags: --target aarch64-apple-darwin
//@ [loongarch64] needs-llvm-components: loongarch
//@ [loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 -C link-dead-code
//@ compile-flags: -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
//@ minicore-compile-flags: -Ccodegen-units=1

#![crate_type = "lib"]
#![feature(no_core, f16, f128)]
#![no_core]

extern crate minicore;
use minicore::*;

pub fn foo(_: f128) {}
// aarch64: !{i64 0, !"_ZTSFveE"}
// x64: !{i64 0, !"_ZTSFvgE"}
// darwin: !{i64 0, !"_ZTSFvgE"}
// loongarch64: !{i64 0, !"_ZTSFveE"}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
//
//@ add-minicore
//@ needs-sanitizer-cfi
//@ revisions: aarch64 x64 darwin loongarch64
//@ [aarch64] needs-llvm-components: aarch64
//@ [aarch64] compile-flags: --target aarch64-unknown-linux-gnu
//@ [x64] needs-llvm-components: x86
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu
//@ [darwin] needs-llvm-components: aarch64
//@ [darwin] compile-flags: --target aarch64-apple-darwin
//@ [loongarch64] needs-llvm-components: loongarch
//@ [loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 -C link-dead-code
//@ compile-flags: -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
//@ minicore-compile-flags: -Ccodegen-units=1
Expand Down Expand Up @@ -229,6 +238,15 @@ pub fn foo66(_: f128, _: f128, _: f128) {}
// CHECK: ![[TYPE61]] = !{i64 0, !"_ZTSFvDhE"}
// CHECK: ![[TYPE62]] = !{i64 0, !"_ZTSFvDhDhE"}
// CHECK: ![[TYPE63]] = !{i64 0, !"_ZTSFvDhDhDhE"}
// CHECK: ![[TYPE64]] = !{i64 0, !"_ZTSFvgE"}
// CHECK: ![[TYPE65]] = !{i64 0, !"_ZTSFvggE"}
// CHECK: ![[TYPE66]] = !{i64 0, !"_ZTSFvgggE"}
// aarch64: ![[TYPE64]] = !{i64 0, !"_ZTSFveE"}
// x64: ![[TYPE64]] = !{i64 0, !"_ZTSFvgE"}
// darwin: ![[TYPE64]] = !{i64 0, !"_ZTSFvgE"}
// loongarch64: ![[TYPE64]] = !{i64 0, !"_ZTSFveE"}
// aarch64: ![[TYPE65]] = !{i64 0, !"_ZTSFveeE"}
// x64: ![[TYPE65]] = !{i64 0, !"_ZTSFvggE"}
// darwin: ![[TYPE65]] = !{i64 0, !"_ZTSFvggE"}
// loongarch64: ![[TYPE65]] = !{i64 0, !"_ZTSFveeE"}
// aarch64: ![[TYPE66]] = !{i64 0, !"_ZTSFveeeE"}
// x64: ![[TYPE66]] = !{i64 0, !"_ZTSFvgggE"}
// darwin: ![[TYPE66]] = !{i64 0, !"_ZTSFvgggE"}
// loongarch64: ![[TYPE66]] = !{i64 0, !"_ZTSFveeeE"}
Loading