[llvm] daab6ad - [PowerPC][test] Improve .got2 and .toc tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 1 22:43:21 PST 2020


Author: Fangrui Song
Date: 2020-03-01T22:41:25-08:00
New Revision: daab6ad58d4b2c90126efacb836c9286fd85031f

URL: https://github.com/llvm/llvm-project/commit/daab6ad58d4b2c90126efacb836c9286fd85031f
DIFF: https://github.com/llvm/llvm-project/commit/daab6ad58d4b2c90126efacb836c9286fd85031f.diff

LOG: [PowerPC][test] Improve .got2 and .toc tests

There is no .got2 test for powerpc32.
There is no comdat variable test for powerpc{32,64}.

Added: 
    

Modified: 
    llvm/test/CodeGen/PowerPC/mcm-1.ll
    llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/PowerPC/mcm-1.ll b/llvm/test/CodeGen/PowerPC/mcm-1.ll
index 5016815af48c..08bae365f18b 100644
--- a/llvm/test/CodeGen/PowerPC/mcm-1.ll
+++ b/llvm/test/CodeGen/PowerPC/mcm-1.ll
@@ -7,7 +7,11 @@
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
 
+$fi = comdat any
+
 @ei = external global i32
+ at fi = global i32 0, align 4, comdat($fi)
+ at gi = global i32 0, align 4, comdat($fi)
 
 define signext i32 @test_external() nounwind {
 entry:
@@ -17,11 +21,25 @@ entry:
   ret i32 %0
 }
 
+define i32 @load() {
+entry:
+  %0 = load i32, i32* @gi, align 4
+  %1 = load i32, i32* @fi, align 4
+  %2 = add i32 %0, %1
+  ret i32 %2
+}
+
 ; CHECK-LABEL: test_external:
 ; CHECK: addis [[REG1:[0-9]+]], 2, .LC[[TOCNUM:[0-9]+]]@toc at ha
 ; CHECK: ld [[REG2:[0-9]+]], .LC[[TOCNUM]]@toc at l([[REG1]])
 ; CHECK: lwz {{[0-9]+}}, 0([[REG2]])
 ; CHECK: stw {{[0-9]+}}, 0([[REG2]])
-; CHECK: .section .toc
-; CHECK: .LC[[TOCNUM]]:
-; CHECK: .tc {{[a-z0-9A-Z_.]+}}[TC],{{[a-z0-9A-Z_.]+}}
+
+
+; CHECK:      .section .toc,"aw", at progbits
+; CHECK-NEXT: .LC0:
+; CHECK-NEXT:  .tc ei[TC],ei
+; CHECK-NEXT: .LC1:
+; CHECK-NEXT:  .tc fi[TC],fi
+; CHECK-NEXT: .LC2:
+; CHECK-NEXT:  .tc gi[TC],gi

diff  --git a/llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll b/llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
index 1a36ac3c8913..b583f00787ab 100644
--- a/llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
+++ b/llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
@@ -1,12 +1,16 @@
-; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck -check-prefix=LARGE-BSS %s
-; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
+; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck --check-prefixes=LARGE,LARGE-BSS %s
+; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck --check-prefixes=LARGE,LARGE-SECUREPLT %s
 ; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
 ; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
 ; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
 ; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
 ; RUN: llc < %s -mtriple=powerpc-linux-musl -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
 ; RUN: llc < %s -mtriple=powerpc-linux-musl -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
+$bar1 = comdat any
+
 @bar = common global i32 0, align 4
+ at bar1 = global i32 0, align 4, comdat($bar1)
+ at bar2 = global i32 0, align 4, comdat($bar1)
 
 declare i32 @call_foo(i32, ...)
 
@@ -17,6 +21,14 @@ entry:
   ret i32 %0
 }
 
+define i32 @load() {
+entry:
+  %0 = load i32, i32* @bar1
+  %1 = load i32, i32* @bar2
+  %2 = add i32 %0, %1
+  ret i32 %2
+}
+
 !llvm.module.flags = !{!0}
 !0 = !{i32 1, !"PIC Level", i32 2}
 ; LARGE-BSS:       [[POFF:\.L[0-9]+\$poff]]:
@@ -33,10 +45,19 @@ entry:
 ; LARGE-BSS-DAG:     lwz {{[0-9]+}}, 0([[VREG]])
 ; LARGE-BSS-DAG:     stw {{[0-9]+}}, 8(1)
 ; LARGE-BSS:         lwz 30, 24(1)
-; LARGE-BSS:       .section .got2,"aw", at progbits
-; LARGE-BSS-NEXT:    .p2align 2
-; LARGE-BSS-NEXT:  [[VREF]]:
-; LARGE-BSS-NEXT:    .long bar
 ; LARGE-SECUREPLT:   addis 30, 30, .LTOC-.L0$pb at ha
 ; LARGE-SECUREPLT:   addi 30, 30, .LTOC-.L0$pb at l
 ; LARGE-SECUREPLT:   bl call_foo at PLT+32768
+
+; LARGE:      .section .bss.bar1,"aGw", at nobits,bar1,comdat
+; LARGE:      bar1:
+; LARGE:      .section .bss.bar2,"aGw", at nobits,bar1,comdat
+; LARGE:      bar2:
+; LARGE:      .section .got2,"aw", at progbits
+; LARGE-NEXT: .p2align 2
+; LARGE-NEXT: .LC0:
+; LARGE-NEXT:  .long bar
+; LARGE-NEXT: .LC1:
+; LARGE-NEXT:  .long bar1
+; LARGE-NEXT: .LC2:
+; LARGE-NEXT:  .long bar2


        


More information about the llvm-commits mailing list