xref: /llvm-project/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo.ll (revision 49bc3077cbf848de6ce07e6f0da82476314924b4)
1; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr7 \
2; RUN:     -mattr=+altivec  -vec-extabi -xcoff-traceback-table=true < %s | \
3; RUN:   FileCheck --check-prefixes=CHECK-ASM,COMMON %s
4
5; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -function-sections \
6; RUN:     -mcpu=pwr7 -mattr=+altivec -vec-extabi < %s | \
7; RUN:   FileCheck --check-prefixes=CHECK-FUNC,COMMON %s
8
9;; #include <altivec.h>
10;; vector float f(vector int vi1, int i1, int i2, float f1, vector float vf,double d1, vector char vc1) {
11;;   return vec_abs(vf);
12;; }
13;; vector float fin(int x) {
14;;  vector float vf ={1.0,1.0,1.0,1.0};
15;;  if (x) return vf;
16;;  return vec_abs(vf);
17;; }
18
19define dso_local <4 x float> @f(<4 x i32> %vi1, i32 signext %i1, i32 signext %i2, float %f1, <4 x float> %vf, double %d1, <16 x i8> %vc1) #0 {
20entry:
21  %__a.addr.i = alloca <4 x float>, align 16
22  %vi1.addr = alloca <4 x i32>, align 16
23  %i1.addr = alloca i32, align 4
24  %i2.addr = alloca i32, align 4
25  %f1.addr = alloca float, align 4
26  %vf.addr = alloca <4 x float>, align 16
27  %d1.addr = alloca double, align 8
28  %vc1.addr = alloca <16 x i8>, align 16
29  store <4 x i32> %vi1, ptr %vi1.addr, align 16
30  store i32 %i1, ptr %i1.addr, align 4
31  store i32 %i2, ptr %i2.addr, align 4
32  store float %f1, ptr %f1.addr, align 4
33  store <4 x float> %vf, ptr %vf.addr, align 16
34  store double %d1, ptr %d1.addr, align 8
35  store <16 x i8> %vc1, ptr %vc1.addr, align 16
36  %0 = load <4 x float>, ptr %vf.addr, align 16
37  store <4 x float> %0, ptr %__a.addr.i, align 16
38  %1 = load <4 x float>, ptr %__a.addr.i, align 16
39  %2 = load <4 x float>, ptr %__a.addr.i, align 16
40  %3 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %2) #2
41  ret <4 x float> %3
42}
43
44define <4 x float> @fin(i32 %x) #0 {
45entry:
46  %__a.addr.i = alloca <4 x float>, align 16
47  %__res.i = alloca <4 x i32>, align 16
48  %retval = alloca <4 x float>, align 16
49  %x.addr = alloca i32, align 4
50  %vf = alloca <4 x float>, align 16
51  store i32 %x, ptr %x.addr, align 4
52  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %vf, align 16
53  %0 = load i32, ptr %x.addr, align 4
54  %tobool = icmp ne i32 %0, 0
55  br i1 %tobool, label %if.then, label %if.end
56
57if.then:                                          ; preds = %entry
58  %1 = load <4 x float>, ptr %vf, align 16
59  store <4 x float> %1, ptr %retval, align 16
60  br label %return
61
62if.end:                                           ; preds = %entry
63  %2 = load <4 x float>, ptr %vf, align 16
64  store <4 x float> %2, ptr %__a.addr.i, align 16
65  %3 = load <4 x float>, ptr %__a.addr.i, align 16
66  %4 = bitcast <4 x float> %3 to <4 x i32>
67  %and.i = and <4 x i32> %4, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
68  store <4 x i32> %and.i, ptr %__res.i, align 16
69  %5 = load <4 x i32>, ptr %__res.i, align 16
70  %6 = bitcast <4 x i32> %5 to <4 x float>
71  store <4 x float> %6, ptr %retval, align 16
72  br label %return
73
74return:                                           ; preds = %if.end, %if.then
75  %7 = load <4 x float>, ptr %retval, align 16
76  ret <4 x float> %7
77}
78
79declare <4 x float> @llvm.fabs.v4f32(<4 x float>) #1
80
81; COMMON:      L..f0:
82; COMMON-NEXT:  .vbyte  4, 0x00000000                   # Traceback table begin
83; COMMON-NEXT:  .byte   0x00                            # Version = 0
84; COMMON-NEXT:  .byte   0x09                            # Language = CPlusPlus
85; COMMON-NEXT:  .byte   0x22                            # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
86; COMMON-NEXT:                                         # +HasTraceBackTableOffset, -IsInternalProcedure
87; COMMON-NEXT:                                         # -HasControlledStorage, -IsTOCless
88; COMMON-NEXT:                                         # +IsFloatingPointPresent
89; COMMON-NEXT:                                         # -IsFloatingPointOperationLogOrAbortEnabled
90; COMMON-NEXT:  .byte   0x40                            # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
91; COMMON-NEXT:                                         # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
92; COMMON-NEXT:  .byte   0x00                            # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
93; COMMON-NEXT:  .byte   0x40                            # -HasExtensionTable, +HasVectorInfo, NumOfGPRsSaved = 0
94; COMMON-NEXT:  .byte   0x02                            # NumberOfFixedParms = 2
95; COMMON-NEXT:  .byte   0x05                            # NumberOfFPParms = 2, +HasParmsOnStack
96; COMMON-NEXT:  .vbyte  4, 0x42740000                   # Parameter type = v, i, i, f, v, d, v
97; CHECK-ASM-NEXT:  .vbyte  4, L..f0-.f                     # Function size
98; CHECK-FUNC-NEXT: .vbyte  4, L..f0-.f[PR]                 # Function size
99; COMMON-NEXT:  .vbyte  2, 0x0001                       # Function name len = 1
100; COMMON-NEXT:  .byte   102                             # Function Name
101; COMMON-NEXT:  .byte   0x00                            # NumOfVRsSaved = 0, -IsVRSavedOnStack, -HasVarArgs
102; COMMON-NEXT:  .byte   0x07                            # NumOfVectorParams = 3, +HasVMXInstruction
103; COMMON-NEXT:  .vbyte  4, 0xb0000000                   # Vector Parameter type = vi, vf, vc
104; COMMON-NEXT:  .vbyte  2, 0x0000                       # Padding
105
106; COMMON:     L..fin0:
107; COMMON-NEXT:  .vbyte  4, 0x00000000                   # Traceback table begin
108; COMMON-NEXT:  .byte   0x00                            # Version = 0
109; COMMON-NEXT:  .byte   0x09                            # Language = CPlusPlus
110; COMMON-NEXT:  .byte   0x22                            # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
111; COMMON-NEXT:                                         # +HasTraceBackTableOffset, -IsInternalProcedure
112; COMMON-NEXT:                                         # -HasControlledStorage, -IsTOCless
113; COMMON-NEXT:                                         # +IsFloatingPointPresent
114; COMMON-NEXT:                                         # -IsFloatingPointOperationLogOrAbortEnabled
115; COMMON-NEXT:  .byte   0x40                            # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
116; COMMON-NEXT:                                         # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
117; COMMON-NEXT:  .byte   0x00                            # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
118; COMMON-NEXT:  .byte   0x40                            # -HasExtensionTable, +HasVectorInfo, NumOfGPRsSaved = 0
119; COMMON-NEXT:  .byte   0x01                            # NumberOfFixedParms = 1
120; COMMON-NEXT:  .byte   0x01                            # NumberOfFPParms = 0, +HasParmsOnStack
121; COMMON-NEXT:  .vbyte  4, 0x00000000                   # Parameter type = i
122; CHECK-ASM-NEXT:       .vbyte  4, L..fin0-.fin                 # Function size
123; CHECK-FUNC-NEXT:      .vbyte  4, L..fin0-.fin[PR]             # Function size
124; COMMON-NEXT:  .vbyte  2, 0x0003                       # Function name len = 3
125; COMMON-NEXT:  .byte   "fin"                           # Function Name
126; COMMON-NEXT:  .byte   0x00                            # NumOfVRsSaved = 0, -IsVRSavedOnStack, -HasVarArgs
127; COMMON-NEXT:  .byte   0x01                            # NumOfVectorParams = 0, +HasVMXInstruction
128; COMMON-NEXT:  .vbyte  4, 0x00000000                   # Vector Parameter type =
129; COMMON-NEXT:  .vbyte  2, 0x0000                       # Padding
130