Skip to content

Commit 0552f85

Browse files
author
Chen Zheng
committed
address comments
1 parent 94a0b34 commit 0552f85

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

clang/test/Driver/fpatchable-function-entry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
// RUN: %clang --target=aarch64 -fsyntax-only %s -fpatchable-function-entry=2,1 -c -### 2>&1 | FileCheck --check-prefix=21 %s
1616
// 21: "-fpatchable-function-entry=2" "-fpatchable-function-entry-offset=1"
1717

18-
// RUN: not %clang -target powerpc64-ibm-aix-xcoff -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=AIX64 %s
18+
// RUN: not %clang --target=powerpc64-ibm-aix-xcoff -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=AIX64 %s
1919
// AIX64: error: unsupported option '-fpatchable-function-entry=1' for target 'powerpc64-ibm-aix-xcoff'
2020

21-
// RUN: not %clang -target powerpc-ibm-aix-xcoff -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=AIX32 %s
21+
// RUN: not %clang --target=powerpc-ibm-aix-xcoff -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=AIX32 %s
2222
// AIX32: error: unsupported option '-fpatchable-function-entry=1' for target 'powerpc-ibm-aix-xcoff'
2323

2424
// RUN: not %clang --target=x86_64 -fsyntax-only %s -fpatchable-function-entry=1,0, 2>&1 | FileCheck --check-prefix=EXCESS %s

clang/test/Sema/patchable-function-entry-attr-aix.cpp

Lines changed: 0 additions & 4 deletions
This file was deleted.

clang/test/Sema/patchable-function-entry-attr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
// RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu -fsyntax-only -verify=silence %s
1010
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -fsyntax-only -verify=silence %s
1111
// RUN: %clang_cc1 -triple ppc64le -fsyntax-only -verify %s
12+
// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fsyntax-only -verify=AIX %s
13+
// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fsyntax-only -verify=AIX %s
1214

1315
// silence-no-diagnostics
1416

17+
// AIX-error@+2 {{'patchable_function_entry' attribute is not yet supported on AIX}}
1518
// expected-warning@+1 {{unknown attribute 'patchable_function_entry' ignored}}
1619
[[gnu::patchable_function_entry(0)]] void f();

llvm/test/CodeGen/PowerPC/patchable-function-entry.ll

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
; RUN: llc -mtriple=powerpc-unknown-linux-gnu %s -o - | FileCheck %s --check-prefixes=CHECK,PPC32
2-
; RUN: llc -mtriple=powerpc64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64
1+
; RUN: llc -mtriple=powerpc %s -o - | FileCheck %s --check-prefixes=CHECK,PPC32
2+
; RUN: llc -mtriple=powerpc64 %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64
3+
4+
@a = global i32 0, align 4
35

46
define void @f0() {
57
; CHECK-LABEL: f0:
@@ -33,17 +35,24 @@ define void @f2() "patchable-function-entry"="1" {
3335
ret void
3436
}
3537

36-
define void @f3() "patchable-function-entry"="1" "patchable-function-prefix"="2" {
38+
define i32 @f3() "patchable-function-entry"="1" "patchable-function-prefix"="2" {
3739
; CHECK-LABEL: .Ltmp0:
3840
; CHECK-COUNT-2: nop
3941
; CHECK-LABEL: f3:
4042
; CHECK: # %bb.0:
4143
; CHECK-NEXT: nop
42-
; CHECK-NEXT: blr
44+
; PPC32: lis 3, a@ha
45+
; PPC32-NEXT: lwz 3, a@l(3)
46+
; PPC64: addis 3, 2, .LC0@toc@ha
47+
; PPC64-NEXT: ld 3, .LC0@toc@l(3)
48+
; PPC64-NEXT: lwz 3, 0(3)
49+
; CHECK: blr
4350
; CHECK: .section __patchable_function_entries
4451
; PPC32: .p2align 2, 0x0
4552
; PPC64: .p2align 3, 0x0
4653
; PPC32-NEXT: .long .Ltmp0
4754
; PPC64-NEXT: .quad .Ltmp0
48-
ret void
55+
entry:
56+
%0 = load i32, ptr @a, align 4
57+
ret i32 %0
4958
}

0 commit comments

Comments
 (0)