File: split-store-alignment.ll

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (74 lines) | stat: -rw-r--r-- 2,919 bytes parent folder | download | duplicates (9)
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
70
71
72
73
74
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -codegenprepare -mtriple=x86_64-unknown-unknown -force-split-store -S < %s | FileCheck %s

target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-w64-windows-gnu"

define void @split_store_align1(float %x, i64* %p) {
; CHECK-LABEL: @split_store_align1(
; CHECK-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
; CHECK-NEXT:    [[Z:%.*]] = zext i32 0 to i64
; CHECK-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
; CHECK-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
; CHECK-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
; CHECK-NEXT:    store i32 [[B]], i32* [[TMP1]], align 1
; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i64* [[P]] to i32*
; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[TMP2]], i32 1
; CHECK-NEXT:    store i32 0, i32* [[TMP3]], align 1
; CHECK-NEXT:    ret void
;
  %b = bitcast float %x to i32
  %z = zext i32 0 to i64
  %s = shl nuw nsw i64 %z, 32
  %z2 = zext i32 %b to i64
  %o = or i64 %s, %z2
  store i64 %o, i64* %p, align 1
  ret void
}

define void @split_store_align2(float %x, i64* %p) {
; CHECK-LABEL: @split_store_align2(
; CHECK-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
; CHECK-NEXT:    [[Z:%.*]] = zext i32 0 to i64
; CHECK-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
; CHECK-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
; CHECK-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
; CHECK-NEXT:    store i32 [[B]], i32* [[TMP1]], align 2
; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i64* [[P]] to i32*
; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[TMP2]], i32 1
; CHECK-NEXT:    store i32 0, i32* [[TMP3]], align 2
; CHECK-NEXT:    ret void
;
  %b = bitcast float %x to i32
  %z = zext i32 0 to i64
  %s = shl nuw nsw i64 %z, 32
  %z2 = zext i32 %b to i64
  %o = or i64 %s, %z2
  store i64 %o, i64* %p, align 2
  ret void
}

define void @split_store_align8(float %x, i64* %p) {
; CHECK-LABEL: @split_store_align8(
; CHECK-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
; CHECK-NEXT:    [[Z:%.*]] = zext i32 0 to i64
; CHECK-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
; CHECK-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
; CHECK-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
; CHECK-NEXT:    store i32 [[B]], i32* [[TMP1]], align 8
; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i64* [[P]] to i32*
; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[TMP2]], i32 1
; CHECK-NEXT:    store i32 0, i32* [[TMP3]], align 4
; CHECK-NEXT:    ret void
;
  %b = bitcast float %x to i32
  %z = zext i32 0 to i64
  %s = shl nuw nsw i64 %z, 32
  %z2 = zext i32 %b to i64
  %o = or i64 %s, %z2
  store i64 %o, i64* %p, align 8
  ret void
}