Summary: The standard data emission directives (e.g. .short, .long) in the AIX assembler have the unintended consequence of aligning their output to the natural byte boundary. This cause problems because we aren't expecting behavior from the Data*bitsDirectives, so the final alignment of data isn't correct in some cases on AIX. This patch updated the Data*bitsDirectives to use .vbyte pseudo-ops instead to emit the data, since we will emit the .align directives as needed. We update the existing testcases and add a test for emission of struct data. Reviewers: hubert.reinterpretcast, Xiangling_L, jasonliu Reviewed By: hubert.reinterpretcast, jasonliu Subscribers: wuzish, nemanjai, hiraditya, kbarton, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80934
75 lines
1.6 KiB
LLVM
75 lines
1.6 KiB
LLVM
; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | \
|
|
; RUN: FileCheck --check-prefixes=CHECK,32BIT %s
|
|
|
|
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | \
|
|
; RUN: FileCheck --check-prefixes=CHECK,64BIT %s
|
|
|
|
|
|
define i32 @foo() {
|
|
entry:
|
|
ret i32 3
|
|
}
|
|
|
|
define i32 @main() {
|
|
entry:
|
|
%0 = call i32 @foo()
|
|
%1 = call i32 bitcast (i32 (...)* @extern_foo to i32 ()*)()
|
|
%2 = call i32 @static_foo()
|
|
%3 = add nsw i32 %0, %1
|
|
%4 = add nsw i32 %3, %2
|
|
ret i32 %4
|
|
}
|
|
|
|
declare i32 @extern_foo(...)
|
|
|
|
define internal i32 @static_foo() {
|
|
entry:
|
|
ret i32 3
|
|
}
|
|
|
|
; CHECK: .globl foo[DS]
|
|
; CHECK: .globl .foo
|
|
; 32BIT: .csect foo[DS],2
|
|
; 32BIT-NEXT: .vbyte 4, .foo
|
|
; 32BIT-NEXT: .vbyte 4, TOC[TC0]
|
|
; 32BIT-NEXT: .vbyte 4, 0
|
|
; 64BIT: .csect foo[DS],3
|
|
; 64BIT-NEXT: .vbyte 8, .foo
|
|
; 64BIT-NEXT: .vbyte 8, TOC[TC0]
|
|
; 64BIT-NEXT: .vbyte 8, 0
|
|
; CHECK-NEXT: .csect .text[PR],2
|
|
; CHECK-LABEL: .foo:
|
|
|
|
; CHECK: .globl main[DS]
|
|
; CHECK: .globl .main
|
|
; 32BIT: .csect main[DS],2
|
|
; 32BIT-NEXT: .vbyte 4, .main
|
|
; 32BIT-NEXT: .vbyte 4, TOC[TC0]
|
|
; 32BIT-NEXT: .vbyte 4, 0
|
|
; 64BIT: .csect main[DS],3
|
|
; 64BIT-NEXT: .vbyte 8, .main
|
|
; 64BIT-NEXT: .vbyte 8, TOC[TC0]
|
|
; 64BIT-NEXT: .vbyte 8, 0
|
|
; CHECK-NEXT: .csect .text[PR],2
|
|
; CHECK-LABEL: .main:
|
|
; CHECK: bl .foo
|
|
; CHECK: bl .extern_foo
|
|
; CHECK: bl .static_foo
|
|
|
|
; CHECK: .lglobl .static_foo
|
|
; 32BIT: .csect static_foo[DS],2
|
|
; 32BIT-NEXT: .vbyte 4, .static_foo
|
|
; 32BIT-NEXT: .vbyte 4, TOC[TC0]
|
|
; 32BIT-NEXT: .vbyte 4, 0
|
|
; 64BIT: .csect static_foo[DS],3
|
|
; 64BIT-NEXT: .vbyte 8, .static_foo
|
|
; 64BIT-NEXT: .vbyte 8, TOC[TC0]
|
|
; 64BIT-NEXT: .vbyte 8, 0
|
|
; CHECK-NEXT: .csect .text[PR],2
|
|
; CHECK-LABEL: .static_foo:
|
|
|
|
; CHECK-NOT: .csect extern_foo
|
|
|
|
; CHECK: .toc
|
|
; CHECK-NOT: .tc
|