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" 3 4 @x = external global <2 x i64>, align 16 5 @xx = external global [13 x <2 x i64>], align 16 6 7 @x.as2 = external addrspace(2) global <2 x i64>, align 16 8 9 ; CHECK-LABEL: @static_hem( 10 ; CHECK: , align 16 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 14 ret <2 x i64> %tmp1 15 } 16 17 ; CHECK-LABEL: @static_hem_addrspacecast( 18 ; CHECK: , align 16 19 define <2 x i64> @static_hem_addrspacecast() { 20 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7 21 %t.asc = addrspacecast <2 x i64>* %t to <2 x i64> addrspace(1)* 22 %tmp1 = load <2 x i64>, <2 x i64> addrspace(1)* %t.asc, align 1 23 ret <2 x i64> %tmp1 24 } 25 26 ; CHECK-LABEL: @static_hem_addrspacecast_smaller_ptr( 27 ; CHECK: , align 16 28 define <2 x i64> @static_hem_addrspacecast_smaller_ptr() { 29 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7 30 %t.asc = addrspacecast <2 x i64>* %t to <2 x i64> addrspace(2)* 31 %tmp1 = load <2 x i64>, <2 x i64> addrspace(2)* %t.asc, align 1 32 ret <2 x i64> %tmp1 33 } 34 35 ; CHECK-LABEL: @static_hem_addrspacecast_larger_ptr( 36 ; CHECK: , align 16 37 define <2 x i64> @static_hem_addrspacecast_larger_ptr() { 38 %t = getelementptr <2 x i64>, <2 x i64> addrspace(2)* @x.as2, i32 7 39 %t.asc = addrspacecast <2 x i64> addrspace(2)* %t to <2 x i64> addrspace(1)* 40 %tmp1 = load <2 x i64>, <2 x i64> addrspace(1)* %t.asc, align 1 41 ret <2 x i64> %tmp1 42 } 43 44 ; CHECK-LABEL: @hem( 45 ; CHECK: , align 16 46 define <2 x i64> @hem(i32 %i) { 47 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i 48 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 49 ret <2 x i64> %tmp1 50 } 51 52 ; CHECK-LABEL: @hem_2d( 53 ; CHECK: , align 16 54 define <2 x i64> @hem_2d(i32 %i, i32 %j) { 55 %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j 56 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 57 ret <2 x i64> %tmp1 58 } 59 60 ; CHECK-LABEL: @foo( 61 ; CHECK: , align 16 62 define <2 x i64> @foo() { 63 %tmp1 = load <2 x i64>, <2 x i64>* @x, align 1 64 ret <2 x i64> %tmp1 65 } 66 67 ; CHECK-LABEL: @bar( 68 ; CHECK: , align 16 69 ; CHECK: , align 16 70 define <2 x i64> @bar() { 71 %t = alloca <2 x i64> 72 call void @kip(<2 x i64>* %t) 73 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 74 ret <2 x i64> %tmp1 75 } 76 77 ; CHECK-LABEL: @static_hem_store( 78 ; CHECK: , align 16 79 define void @static_hem_store(<2 x i64> %y) { 80 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7 81 store <2 x i64> %y, <2 x i64>* %t, align 1 82 ret void 83 } 84 85 ; CHECK-LABEL: @hem_store( 86 ; CHECK: , align 16 87 define void @hem_store(i32 %i, <2 x i64> %y) { 88 %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i 89 store <2 x i64> %y, <2 x i64>* %t, align 1 90 ret void 91 } 92 93 ; CHECK-LABEL: @hem_2d_store( 94 ; CHECK: , align 16 95 define void @hem_2d_store(i32 %i, i32 %j, <2 x i64> %y) { 96 %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j 97 store <2 x i64> %y, <2 x i64>* %t, align 1 98 ret void 99 } 100 101 ; CHECK-LABEL: @foo_store( 102 ; CHECK: , align 16 103 define void @foo_store(<2 x i64> %y) { 104 store <2 x i64> %y, <2 x i64>* @x, align 1 105 ret void 106 } 107 108 ; CHECK-LABEL: @bar_store( 109 ; CHECK: , align 16 110 define void @bar_store(<2 x i64> %y) { 111 %t = alloca <2 x i64> 112 call void @kip(<2 x i64>* %t) 113 store <2 x i64> %y, <2 x i64>* %t, align 1 114 ret void 115 } 116 117 declare void @kip(<2 x i64>* %t) 118