1 ; RUN: opt -instcombine -S < %s | FileCheck %s
2 target datalayout = "E-p:64:64:64-p1:64:64:64-p2:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
4 @x = external global <2 x i64>, align 16
5 @xx = external global [13 x <2 x i64>], align 16
7 @x.as2 = external addrspace(2) global <2 x i64>, align 16
9 ; CHECK-LABEL: @static_hem(
11 define <2 x i64> @static_hem() {
12 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7
13 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
19 define <2 x i64> @hem(i32 %i) {
20 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i
21 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
25 ; CHECK-LABEL: @hem_2d(
27 define <2 x i64> @hem_2d(i32 %i, i32 %j) {
28 %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j
29 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
35 define <2 x i64> @foo() {
36 %tmp1 = load <2 x i64>, <2 x i64>* @x, align 1
43 define <2 x i64> @bar() {
45 call void @kip(<2 x i64>* %t)
46 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1
50 ; CHECK-LABEL: @static_hem_store(
52 define void @static_hem_store(<2 x i64> %y) {
53 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7
54 store <2 x i64> %y, <2 x i64>* %t, align 1
58 ; CHECK-LABEL: @hem_store(
60 define void @hem_store(i32 %i, <2 x i64> %y) {
61 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i
62 store <2 x i64> %y, <2 x i64>* %t, align 1
66 ; CHECK-LABEL: @hem_2d_store(
68 define void @hem_2d_store(i32 %i, i32 %j, <2 x i64> %y) {
69 %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j
70 store <2 x i64> %y, <2 x i64>* %t, align 1
74 ; CHECK-LABEL: @foo_store(
76 define void @foo_store(<2 x i64> %y) {
77 store <2 x i64> %y, <2 x i64>* @x, align 1
81 ; CHECK-LABEL: @bar_store(
83 define void @bar_store(<2 x i64> %y) {
85 call void @kip(<2 x i64>* %t)
86 store <2 x i64> %y, <2 x i64>* %t, align 1
90 declare void @kip(<2 x i64>* %t)