File: irregular-size.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (55 lines) | stat: -rw-r--r-- 2,359 bytes parent folder | download | duplicates (10)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt < %s -passes=infer-alignment -S | FileCheck %s

define void @non_pow2_size(i177 %X) {
; CHECK-LABEL: define void @non_pow2_size
; CHECK-SAME: (i177 [[X:%.*]]) {
; CHECK-NEXT:    [[A:%.*]] = alloca i177, align 8
; CHECK-NEXT:    [[L1:%.*]] = load i177, ptr [[A]], align 8
; CHECK-NEXT:    store i177 [[X]], ptr [[A]], align 8
; CHECK-NEXT:    ret void
;
  %A = alloca i177, align 1
  %L1 = load i177, ptr %A, align 1
  store i177 %X, ptr %A, align 1
  ret void
}

; TODO: For non-byte-sized vectors, current implementation assumes there is
; padding to the next byte boundary between elements.
@vector_i4 = constant [16 x <2 x i4>] zeroinitializer, align 8

define void @load_vector_i4(i4 %X) {
; CHECK-LABEL: define void @load_vector_i4
; CHECK-SAME: (i4 [[X:%.*]]) {
; CHECK-NEXT:    [[PTR_0:%.*]] = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 1
; CHECK-NEXT:    [[PTR_1:%.*]] = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 2
; CHECK-NEXT:    [[PTR_2:%.*]] = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 4
; CHECK-NEXT:    [[PTR_3:%.*]] = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 8
; CHECK-NEXT:    [[RES_0:%.*]] = load i4, ptr [[PTR_0]], align 1
; CHECK-NEXT:    [[RES_1:%.*]] = load i4, ptr [[PTR_1]], align 2
; CHECK-NEXT:    [[RES_2:%.*]] = load i4, ptr [[PTR_2]], align 4
; CHECK-NEXT:    [[RES_3:%.*]] = load i4, ptr [[PTR_3]], align 8
; CHECK-NEXT:    store i4 [[X]], ptr [[PTR_0]], align 1
; CHECK-NEXT:    store i4 [[X]], ptr [[PTR_1]], align 2
; CHECK-NEXT:    store i4 [[X]], ptr [[PTR_2]], align 4
; CHECK-NEXT:    store i4 [[X]], ptr [[PTR_3]], align 8
; CHECK-NEXT:    ret void
;
  %ptr.0 = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 1
  %ptr.1 = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 2
  %ptr.2 = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 4
  %ptr.3 = getelementptr [16 x <2 x i4>], ptr @vector_i4, i64 0, i64 8

  %res.0 = load i4, ptr %ptr.0, align 1
  %res.1 = load i4, ptr %ptr.1, align 1
  %res.2 = load i4, ptr %ptr.2, align 1
  %res.3 = load i4, ptr %ptr.3, align 1

  store i4 %X, ptr %ptr.0, align 1
  store i4 %X, ptr %ptr.1, align 1
  store i4 %X, ptr %ptr.2, align 1
  store i4 %X, ptr %ptr.3, align 1

  ret void
}