xref: /llvm-project/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-tw.ll (revision b1acb7a315e903ee340a33dbc9b2b61b0450bb67)
1; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
2; RUN:   --ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s
3; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
4; RUN:   --ppc-asm-full-reg-names -mcpu=pwr7 < %s | FileCheck %s
5; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu \
6; RUN:   --ppc-asm-full-reg-names -mcpu=pwr7 < %s | FileCheck %s
7; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
8; RUN:   --ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s -check-prefix=AIX
9; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
10; RUN:   --ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s -check-prefix=AIX
11; RUN: llc -mtriple=powerpc-ibm-aix-xcoff -filetype=obj -o %t_32.o < %s
12; RUN: llvm-readobj --exception-section %t_32.o | FileCheck %s --check-prefix=OBJ
13
14; Check that we do not crash in object mode
15; OBJ:       Exception section {
16; OBJ-NEXT:    Symbol: .test__trap_annotation
17
18!1 = !{!"ppc-trap-reason", !"1", !"2"}
19declare void @llvm.ppc.trap(i32 %a)
20declare void @llvm.ppc.tw(i32 %a, i32 %b, i32 immarg)
21define dso_local void @test__trap_annotation(i32 %a) {
22; CHECK-LABEL: test__trap_annotation:
23; CHECK:       # %bb.0:
24; CHECK-NEXT:    twi 24, r3, 0
25; CHECK-NEXT:    blr
26;
27; AIX-LABEL: test__trap_annotation:
28; AIX:       # %bb.0:
29; AIX-NEXT:  L..tmp0:
30; AIX-NEXT:    .except .test__trap_annotation, 1, 2
31; AIX-NEXT:    twi 24, r3, 0
32; AIX-NEXT:    blr
33  call void @llvm.ppc.trap(i32 %a), !annotation !1
34  ret void
35}
36
37define dso_local void @test__tw_annotation(i32 %a) {
38; CHECK-LABEL: test__tw_annotation:
39; CHECK:       # %bb.0:
40; CHECK-NEXT:    twi 0, r3, 4
41; CHECK-NEXT:    blr
42;
43; AIX-LABEL: test__tw_annotation:
44; AIX:       # %bb.0:
45; AIX-NEXT:  L..tmp1:
46; AIX-NEXT:    .except .test__tw_annotation, 1, 2
47; AIX-NEXT:    twi 0, r3, 4
48; AIX-NEXT:    blr
49  call void @llvm.ppc.tw(i32 4, i32 %a, i32 0), !annotation !1
50  ret void
51}
52