File: ppc64-struct-onefloat.c

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,634,820 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (49 lines) | stat: -rw-r--r-- 2,535 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s

typedef struct s1 { float f; } Sf;
typedef struct s2 { double d; } Sd;
typedef struct s4 { Sf fs; } SSf;
typedef struct s5 { Sd ds; } SSd;

void bar(Sf a, Sd b, SSf d, SSd e) {}

// CHECK-LABEL: define{{.*}} void @bar
// CHECK:  %a = alloca %struct.s1, align 4
// CHECK:  %b = alloca %struct.s2, align 8
// CHECK:  %d = alloca %struct.s4, align 4
// CHECK:  %e = alloca %struct.s5, align 8
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s1, ptr %a, i32 0, i32 0
// CHECK:  store float %a.coerce, ptr %{{[a-zA-Z0-9.]+}}, align 4
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s2, ptr %b, i32 0, i32 0
// CHECK:  store double %b.coerce, ptr %{{[a-zA-Z0-9.]+}}, align 8
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s4, ptr %d, i32 0, i32 0
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s1, ptr %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
// CHECK:  store float %d.coerce, ptr %{{[a-zA-Z0-9.]+}}, align 4
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s5, ptr %e, i32 0, i32 0
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s2, ptr %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
// CHECK:  store double %e.coerce, ptr %{{[a-zA-Z0-9.]+}}, align 8
// CHECK:  ret void

void foo(void) 
{
  Sf p1 = { 22.63f };
  Sd p2 = { 19.47 };
  SSf p4 = { { 22.63f } };
  SSd p5 = { { 19.47 } };
  bar(p1, p2, p4, p5);
}

// CHECK-LABEL: define{{.*}} void @foo
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s1, ptr %p1, i32 0, i32 0
// CHECK:  %{{[0-9]+}} = load float, ptr %{{[a-zA-Z0-9.]+}}, align 4
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s2, ptr %p2, i32 0, i32 0
// CHECK:  %{{[0-9]+}} = load double, ptr %{{[a-zA-Z0-9.]+}}, align 8
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s4, ptr %p4, i32 0, i32 0
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s1, ptr %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
// CHECK:  %{{[0-9]+}} = load float, ptr %{{[a-zA-Z0-9.]+}}, align 4
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s5, ptr %p5, i32 0, i32 0
// CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr inbounds %struct.s2, ptr %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
// CHECK:  %{{[0-9]+}} = load double, ptr %{{[a-zA-Z0-9.]+}}, align 8
// CHECK:  call void @bar(float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}, float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}})
// CHECK:  ret void