Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit d11a6cc

Browse files
committed
For X86-64 linux and PPC64 linux align int128 to 16 bytes.
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
1 parent dffd427 commit d11a6cc

21 files changed

+29
-19
lines changed

lib/Target/PowerPC/PPCTargetMachine.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ static std::string getDataLayoutString(const Triple &T) {
120120
else
121121
Ret += "-f64:32:64";
122122

123+
// 128 bit integers are always aligned to 128 bits, but only 64-bit matters,
124+
// because __int128 is only supoprted on 64-bit targets.
125+
if (is64Bit && T.isOSLinux())
126+
Ret += "-i128:128";
127+
123128
// PPC64 has 32 and 64 bit registers, PPC32 has only 32 bit ones.
124129
if (is64Bit)
125130
Ret += "-n32:64";

lib/Target/X86/X86TargetMachine.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ static std::string computeDataLayout(const Triple &TT) {
109109
else
110110
Ret += "-f64:32:64";
111111

112+
// 128 bit integers are always aligned to 128 bits, but only 64-bit matters,
113+
// because __int128 is only supoprted on 64-bit targets.
114+
if (TT.isArch64Bit() && TT.isOSLinux())
115+
Ret += "-i128:128";
116+
112117
// Some ABIs align long double to 128 bits, others to 32.
113118
if (TT.isOSNaCl() || TT.isOSIAMCU())
114119
; // No f80

test/LTO/Resolution/X86/Inputs/comdat.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-unknown-linux-gnu"
33

44
$c2 = comdat any

test/LTO/Resolution/X86/Inputs/common2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-unknown-linux-gnu"
33

44
@v = common global i16 0, align 4

test/LTO/Resolution/X86/Inputs/mixed_lto.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-unknown-linux-gnu"
33
declare i32 @g()
44
define i32 @main() {

test/LTO/Resolution/X86/comdat.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
; RUN: -r=%t2.o,a25,px
2323
; RUN: llvm-dis %t3.o.0.2.internalize.bc -o - | FileCheck %s
2424

25-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2626
target triple = "x86_64-unknown-linux-gnu"
2727

2828
$c1 = comdat any

test/LTO/Resolution/X86/common2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
; RUN: -r %t2.bc,bar,px
7171
; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED2
7272

73-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
73+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
7474
target triple = "x86_64-unknown-linux-gnu"
7575

7676
@v = common global i8 0, align 8

test/LTO/Resolution/X86/lowertypetests.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
; MERGED: R __typeid_foo_global_addr
77
; CHECK: U __typeid_foo_global_addr
88

9-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
1010
target triple = "x86_64-unknown-linux-gnu"
1111

1212
@foo = global i32 0, !type !0

test/LTO/Resolution/X86/mixed_lto.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
; RUN: llvm-nm %t5.o.0 | FileCheck %s --check-prefix=NM0
2020
; RUN: llvm-nm %t5.o.1 | FileCheck %s --check-prefix=NM1
2121

22-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2323
target triple = "x86_64-unknown-linux-gnu"
2424
define i32 @g() {
2525
ret i32 0

test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; ModuleID = 'debuginfo-compositetype-import2.c'
22
source_filename = "debuginfo-compositetype-import2.c"
3-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
44
target triple = "x86_64-unknown-linux-gnu"
55

66
; Function Attrs: nounwind uwtable

test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-grtev4-linux-gnu"
33

44
define i32 @main() #0 {

test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-unknown-linux-gnu"
33

44
$c2 = comdat any

test/ThinLTO/X86/Inputs/module_asm.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-unknown-linux-gnu"
33

44
define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {

test/ThinLTO/X86/Inputs/module_asm2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
22
target triple = "x86_64-unknown-linux-gnu"
33

44
define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {

test/ThinLTO/X86/cache-config.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -default-triple=x86_64-unknown-linux-gnu
1919
; RUN: ls %t.cache | count 15
2020

21-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
21+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2222
target triple = "x86_64-unknown-linux-gnu"
2323

2424
define void @globalfunc() {

test/ThinLTO/X86/debuginfo-compositetype-import.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
; ModuleID = 'debuginfo-compositetype-import.c'
3636
source_filename = "debuginfo-compositetype-import.c"
37-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
37+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
3838
target triple = "x86_64-unknown-linux-gnu"
3939

4040
; Function Attrs: nounwind uwtable

test/ThinLTO/X86/linkonce_aliasee_ref_import.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
; Check that we imported a ref (and not def) to baz.clone
2525
; NM2: U baz.clone
2626

27-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2828
target triple = "x86_64-grtev4-linux-gnu"
2929

3030
$baz.clone = comdat any

test/ThinLTO/X86/linkonce_resolution_comdat.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
; and inlined into g()
2222
; NM2-NOT: f
2323

24-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
24+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2525
target triple = "x86_64-unknown-linux-gnu"
2626

2727
$c1 = comdat any

test/ThinLTO/X86/module_asm2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
; NM1-NOT: b
6565
; NM1-NOT: x
6666

67-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
67+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
6868
target triple = "x86_64-unknown-linux-gnu"
6969

7070
@b = internal global i32 1, align 4

test/ThinLTO/X86/module_asm_glob.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
; NM0: T foo
1818
; NM1-NOT: foo
1919

20-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2121
target triple = "x86_64-unknown-linux-gnu"
2222

2323
module asm "\09.text"

test/tools/llvm-lto2/X86/pipeline.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
; is accepted).
1111
; RUN: llvm-lto2 %t1.bc -o %t.o -lto-use-new-pm -r %t1.bc,patatino,px
1212

13-
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
13+
target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
1414
target triple = "x86_64-unknown-linux-gnu"
1515

1616
define void @patatino() {

0 commit comments

Comments
 (0)