File: align-systemz-02.c

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (69 lines) | stat: -rw-r--r-- 2,387 bytes parent folder | download | duplicates (3)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// RUN: %clang_cc1 -triple s390x-linux-gnu %s -o - -target-feature +vector -emit-llvm \
// RUN:    | FileCheck %s -check-prefix=VECIR
// RUN: %clang_cc1 -triple s390x-linux-gnu %s -o - -target-feature +vector -S \
// RUN:    | FileCheck %s -check-prefix=VECASM
// RUN: %clang_cc1 -triple s390x-linux-gnu %s -o - -target-feature -vector -emit-llvm \
// RUN:    | FileCheck %s -check-prefix=SCALIR
// RUN: %clang_cc1 -triple s390x-linux-gnu %s -o - -target-feature -vector -S \
// RUN:    | FileCheck %s -check-prefix=SCALASM
// REQUIRES: systemz-registered-target

typedef __attribute__((vector_size(16))) signed int vec_sint;

volatile vec_sint GlobVsi;

struct S {
  int A;
  vec_sint Vsi;
} GlobS;

void fun() {
  GlobS.Vsi = GlobVsi;
}

// VECIR: %struct.S = type { i32, <4 x i32> }
// VECIR: @GlobVsi = global <4 x i32> zeroinitializer, align 8
// VECIR: @GlobS = global %struct.S zeroinitializer, align 8
// VECIR: %0 = load volatile <4 x i32>, ptr @GlobVsi, align 8
// VECIR: store <4 x i32> %0, ptr getelementptr inbounds (%struct.S, ptr @GlobS, i32 0, i32 1), align 8

// VECASM:      lgrl %r1, GlobVsi@GOT
// VECASM-NEXT: vl   %v0, 0(%r1), 3
// VECASM-NEXT: lgrl %r1, GlobS@GOT
// VECASM-NEXT: vst  %v0, 8(%r1), 3
//
// VECASM:   .globl  GlobVsi
// VECASM:   .p2align        3
// VECASM: GlobVsi:
// VECASM:   .space  16
// VECASM:   .globl  GlobS
// VECASM:   .p2align        3
// VECASM: GlobS:
// VECASM:   .space  24

// SCALIR: %struct.S = type { i32, [12 x i8], <4 x i32> }
// SCALIR: @GlobVsi = global <4 x i32> zeroinitializer, align 16
// SCALIR: @GlobS = global %struct.S zeroinitializer, align 16
// SCALIR: %0 = load volatile <4 x i32>, ptr @GlobVsi, align 16
// SCALIR: store <4 x i32> %0, ptr getelementptr inbounds (%struct.S, ptr @GlobS, i32 0, i32 2), align 16

// SCALASM:      lgrl    %r1, GlobVsi@GOT
// SCALASM-NEXT: l       %r0, 0(%r1)
// SCALASM-NEXT: l       %r2, 4(%r1)
// SCALASM-NEXT: l       %r3, 8(%r1)
// SCALASM-NEXT: l       %r4, 12(%r1)
// SCALASM-NEXT: lgrl    %r1, GlobS@GOT
// SCALASM-NEXT: st      %r4, 28(%r1)
// SCALASM-NEXT: st      %r3, 24(%r1)
// SCALASM-NEXT: st      %r2, 20(%r1)
// SCALASM-NEXT: st      %r0, 16(%r1)
//
// SCALASM:   .globl  GlobVsi
// SCALASM:   .p2align        4
// SCALASM: GlobVsi:
// SCALASM:   .space  16
// SCALASM:   .globl  GlobS
// SCALASM:   .p2align        4
// SCALASM: GlobS:
// SCALASM:   .space  32