]> granicus.if.org Git - llvm/commitdiff
For X86-64 linux and PPC64 linux align int128 to 16 bytes.
authorEric Christopher <echristo@gmail.com>
Fri, 10 Feb 2017 03:32:21 +0000 (03:32 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 10 Feb 2017 03:32:21 +0000 (03:32 +0000)
For other platforms we should find out what they need and likely
make the same change, however, a smaller additional change is easier
for platforms we know have it specified in the ABI. As part of this
rewrite some of the handling in the backends for data layout and update
a bunch of testcases.

Based on a patch by Simonas Kazlauskas!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294702 91177308-0d34-0410-b5e6-96231b3b80d8

21 files changed:
lib/Target/PowerPC/PPCTargetMachine.cpp
lib/Target/X86/X86TargetMachine.cpp
test/LTO/Resolution/X86/Inputs/comdat.ll
test/LTO/Resolution/X86/Inputs/common2.ll
test/LTO/Resolution/X86/Inputs/mixed_lto.ll
test/LTO/Resolution/X86/comdat.ll
test/LTO/Resolution/X86/common2.ll
test/LTO/Resolution/X86/lowertypetests.ll
test/LTO/Resolution/X86/mixed_lto.ll
test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll
test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll
test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
test/ThinLTO/X86/Inputs/module_asm.ll
test/ThinLTO/X86/Inputs/module_asm2.ll
test/ThinLTO/X86/cache-config.ll
test/ThinLTO/X86/debuginfo-compositetype-import.ll
test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
test/ThinLTO/X86/linkonce_resolution_comdat.ll
test/ThinLTO/X86/module_asm2.ll
test/ThinLTO/X86/module_asm_glob.ll
test/tools/llvm-lto2/X86/pipeline.ll

index 5d68f32ccc5e1afb0de2e92c7ed6853fedb9adef..8df1a89308fa3cb6f04a4b2f2ed924ab286ab48e 100644 (file)
@@ -120,6 +120,11 @@ static std::string getDataLayoutString(const Triple &T) {
   else
     Ret += "-f64:32:64";
 
+  // 128 bit integers are always aligned to 128 bits, but only 64-bit matters,
+  // because __int128 is only supoprted on 64-bit targets.
+  if (is64Bit && T.isOSLinux())
+    Ret += "-i128:128";
+
   // PPC64 has 32 and 64 bit registers, PPC32 has only 32 bit ones.
   if (is64Bit)
     Ret += "-n32:64";
index 7dd878e8a90f76ca8ce02848c54df51021a6d688..585d5433e6291229f2ed87f05280de5a4dc49718 100644 (file)
@@ -109,6 +109,11 @@ static std::string computeDataLayout(const Triple &TT) {
   else
     Ret += "-f64:32:64";
 
+  // 128 bit integers are always aligned to 128 bits, but only 64-bit matters,
+  // because __int128 is only supoprted on 64-bit targets.
+  if (TT.isArch64Bit() && TT.isOSLinux())
+    Ret += "-i128:128";
+
   // Some ABIs align long double to 128 bits, others to 32.
   if (TT.isOSNaCl() || TT.isOSIAMCU())
     ; // No f80
index ca4bbb4bf81efd68c7830276b2f06d47300b1561..253b4e740906aa48170df5ae1fbaef35b84a1449 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c2 = comdat any
index c3a7f753684dd12acd71691cbfbfaeca8545a391..449f3d5c3438718243ba3caceff775fdebdcc90f 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @v = common global i16 0, align 4
index 2393deb3241450de952933feb61bf300086ac4cf..c1c3f8e06553133d9e0955ece35c64662a194e4d 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 declare i32 @g()
 define i32 @main() {
index 5124b951bed47c78f8fddcc490d07757413b939d..32cada5161e3a5bdacac1430db4eb5283167b708 100644 (file)
@@ -22,7 +22,7 @@
 ; RUN:  -r=%t2.o,a25,px
 ; RUN: llvm-dis %t3.o.0.2.internalize.bc -o - | FileCheck %s
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c1 = comdat any
index 3328d7c5ec36718dd1aa7ea507b2cc360a9d2eab..520ccf27112235d62b75291910e0ea6f3648a68d 100644 (file)
@@ -70,7 +70,7 @@
 ; RUN:  -r %t2.bc,bar,px
 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED2
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @v = common global i8 0, align 8
index 3753689a699fe6b7363688f091f03213f6f524df..7c2230738f0e9eaa33ffeebbc0882026f21d1778 100644 (file)
@@ -6,7 +6,7 @@
 ; MERGED: R __typeid_foo_global_addr
 ; CHECK: U __typeid_foo_global_addr
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @foo = global i32 0, !type !0
index 02b15c61154487bbbb50589c6b4a74549e01a2c0..25f7c59620ee7b7d4a7be43f030d689991be95a5 100644 (file)
@@ -19,7 +19,7 @@
 ; RUN: llvm-nm %t5.o.0 | FileCheck %s --check-prefix=NM0
 ; RUN: llvm-nm %t5.o.1 | FileCheck %s --check-prefix=NM1
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 define i32 @g() {
   ret i32 0
index 7e80c4d7c44719987403a73361215678f5aa13cb..9e4e303f64b926aed6bef54760725881fb0d0879 100644 (file)
@@ -1,6 +1,6 @@
 ; ModuleID = 'debuginfo-compositetype-import2.c'
 source_filename = "debuginfo-compositetype-import2.c"
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 ; Function Attrs: nounwind uwtable
index 66847f50b15151de9938f0f862953a47fd500f0a..f2ca7e9935b0c3bd4a24cb233b4bb63ed82a83b4 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
 
 define i32 @main() #0 {
index 59434a819869eb351d8be68ba495e1bf4c8d86f6..744aa5dc2b1f36d014776e1a5f84f8ad86f53cbe 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c2 = comdat any
index 337e8613c6e9986dee691106db3384ec998d248c..e212788bb1cad5b6d4c99865ddbaea5a4768fdd0 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {
index a8081cccaf3453702a479c9abe5c90c43d682aa3..69a4732215c90ea8c6e28fe57a44311fc27ee40e 100644 (file)
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {
index a947969f669073de7d6ceb87c9485a8ca1081bd7..4953b30983d886a4cde01cb8eb8993f45bed1fff 100644 (file)
@@ -18,7 +18,7 @@
 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -default-triple=x86_64-unknown-linux-gnu
 ; RUN: ls %t.cache | count 15
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define void @globalfunc() {
index 0b3a7a45224e9c59efc2befa8d11b1344f09236c..758ec8b371d22986f89ded2a760dde23e3b64a39 100644 (file)
@@ -34,7 +34,7 @@
 
 ; ModuleID = 'debuginfo-compositetype-import.c'
 source_filename = "debuginfo-compositetype-import.c"
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 ; Function Attrs: nounwind uwtable
index 9b8cc7f7228accb11cb2297bacb69630a89bb224..ee5737baa41a842578d1a73f550327027f64fb40 100644 (file)
@@ -24,7 +24,7 @@
 ; Check that we imported a ref (and not def) to baz.clone
 ; NM2: U baz.clone
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
 
 $baz.clone = comdat any
index c1ffdf176e53a3f53273c3c674519b2ce893cade..43ff8654791685f4226654dec444927c588b925b 100644 (file)
@@ -21,7 +21,7 @@
 ; and inlined into g()
 ; NM2-NOT: f
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c1 = comdat any
index 02404062163deb5eac5237b2439eb62b287a8329..90f4fb3f8606f5b6be581494213cae69baa48f67 100644 (file)
@@ -64,7 +64,7 @@
 ; NM1-NOT: b
 ; NM1-NOT: x
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @b = internal global i32 1, align 4
index bcc44c58c9f01194934b5cd6b57384305a140a72..4973ed0c0cfc374e0128b5db1bf7b1328643a8bf 100644 (file)
@@ -17,7 +17,7 @@
 ; NM0: T foo
 ; NM1-NOT: foo
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 module asm "\09.text"
index e0d03bd932f3b03f0e91221c2a39945b873a82a0..fba09f6c632a8a5f62525350aff73319f7593d1e 100644 (file)
@@ -10,7 +10,7 @@
 ; is accepted).
 ; RUN: llvm-lto2 %t1.bc -o %t.o -lto-use-new-pm -r %t1.bc,patatino,px
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define void @patatino() {