OLD | NEW |
1 ; This file checks support for address mode optimization. | 1 ; This file checks support for address mode optimization. |
2 | 2 |
3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ | 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ |
4 ; RUN: | FileCheck %s | 4 ; RUN: | FileCheck %s |
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 -mattr=sse4.1 \ | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 -mattr=sse4.1 \ |
6 ; RUN: | FileCheck --check-prefix=SSE41 %s | 6 ; RUN: | FileCheck --check-prefix=SSE41 %s |
7 | 7 |
8 define float @load_arg_plus_200000(float* %arg) { | 8 define float @load_arg_plus_200000(float* %arg) { |
9 entry: | 9 entry: |
10 %arg.int = ptrtoint float* %arg to i32 | 10 %arg.int = ptrtoint float* %arg to i32 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ; CHECK: movss xmm0,DWORD PTR [e{{..}}] | 49 ; CHECK: movss xmm0,DWORD PTR [e{{..}}] |
50 } | 50 } |
51 | 51 |
52 define <8 x i16> @load_mul_v8i16_mem(<8 x i16> %arg0, i32 %arg1_iptr) { | 52 define <8 x i16> @load_mul_v8i16_mem(<8 x i16> %arg0, i32 %arg1_iptr) { |
53 entry: | 53 entry: |
54 %addr_sub = sub i32 %arg1_iptr, 200000 | 54 %addr_sub = sub i32 %arg1_iptr, 200000 |
55 %addr_ptr = inttoptr i32 %addr_sub to <8 x i16>* | 55 %addr_ptr = inttoptr i32 %addr_sub to <8 x i16>* |
56 %arg1 = load <8 x i16>* %addr_ptr, align 2 | 56 %arg1 = load <8 x i16>* %addr_ptr, align 2 |
57 %res_vec = mul <8 x i16> %arg0, %arg1 | 57 %res_vec = mul <8 x i16> %arg0, %arg1 |
58 ret <8 x i16> %res_vec | 58 ret <8 x i16> %res_vec |
| 59 ; Address mode optimization is generally unsafe for SSE vector instructions. |
59 ; CHECK-LABEL: load_mul_v8i16_mem | 60 ; CHECK-LABEL: load_mul_v8i16_mem |
60 ; CHECK: pmullw xmm{{.*}},XMMWORD PTR [e{{.*}}-0x30d40] | 61 ; CHECK-NOT: pmullw xmm{{.*}},XMMWORD PTR [e{{..}}-0x30d40] |
61 } | 62 } |
62 | 63 |
63 define <4 x i32> @load_mul_v4i32_mem(<4 x i32> %arg0, i32 %arg1_iptr) { | 64 define <4 x i32> @load_mul_v4i32_mem(<4 x i32> %arg0, i32 %arg1_iptr) { |
64 entry: | 65 entry: |
65 %addr_sub = sub i32 %arg1_iptr, 200000 | 66 %addr_sub = sub i32 %arg1_iptr, 200000 |
66 %addr_ptr = inttoptr i32 %addr_sub to <4 x i32>* | 67 %addr_ptr = inttoptr i32 %addr_sub to <4 x i32>* |
67 %arg1 = load <4 x i32>* %addr_ptr, align 4 | 68 %arg1 = load <4 x i32>* %addr_ptr, align 4 |
68 %res = mul <4 x i32> %arg0, %arg1 | 69 %res = mul <4 x i32> %arg0, %arg1 |
69 ret <4 x i32> %res | 70 ret <4 x i32> %res |
| 71 ; Address mode optimization is generally unsafe for SSE vector instructions. |
70 ; CHECK-LABEL: load_mul_v4i32_mem | 72 ; CHECK-LABEL: load_mul_v4i32_mem |
71 ; CHECK: pmuludq xmm{{.*}},XMMWORD PTR [e{{.*}}-0x30d40] | 73 ; CHECK-NOT: pmuludq xmm{{.*}},XMMWORD PTR [e{{..}}-0x30d40] |
72 ; CHECK: pmuludq | 74 ; CHECK: pmuludq |
73 ; | 75 ; |
74 ; SSE41-LABEL: load_mul_v4i32_mem | 76 ; SSE41-LABEL: load_mul_v4i32_mem |
75 ; SSE41: pmulld xmm{{.*}},XMMWORD PTR [e{{.*}}-0x30d40] | 77 ; SSE41-NOT: pmulld xmm{{.*}},XMMWORD PTR [e{{..}}-0x30d40] |
76 } | 78 } |
77 | 79 |
78 define float @address_mode_opt_chaining(float* %arg) { | 80 define float @address_mode_opt_chaining(float* %arg) { |
79 entry: | 81 entry: |
80 %arg.int = ptrtoint float* %arg to i32 | 82 %arg.int = ptrtoint float* %arg to i32 |
81 %addr1.int = add i32 12, %arg.int | 83 %addr1.int = add i32 12, %arg.int |
82 %addr2.int = sub i32 %addr1.int, 4 | 84 %addr2.int = sub i32 %addr1.int, 4 |
83 %addr2.ptr = inttoptr i32 %addr2.int to float* | 85 %addr2.ptr = inttoptr i32 %addr2.int to float* |
84 %addr2.load = load float* %addr2.ptr, align 4 | 86 %addr2.load = load float* %addr2.ptr, align 4 |
85 ret float %addr2.load | 87 ret float %addr2.load |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 define float @address_mode_opt_sub_min_int(float* %arg) { | 141 define float @address_mode_opt_sub_min_int(float* %arg) { |
140 entry: | 142 entry: |
141 %arg.int = ptrtoint float* %arg to i32 | 143 %arg.int = ptrtoint float* %arg to i32 |
142 %addr1.int = sub i32 %arg.int, 2147483648 | 144 %addr1.int = sub i32 %arg.int, 2147483648 |
143 %addr1.ptr = inttoptr i32 %addr1.int to float* | 145 %addr1.ptr = inttoptr i32 %addr1.int to float* |
144 %addr1.load = load float* %addr1.ptr, align 4 | 146 %addr1.load = load float* %addr1.ptr, align 4 |
145 ret float %addr1.load | 147 ret float %addr1.load |
146 ; CHECK-LABEL: address_mode_opt_sub_min_int | 148 ; CHECK-LABEL: address_mode_opt_sub_min_int |
147 ; CHECK: movss xmm0,DWORD PTR [{{.*}}-0x80000000] | 149 ; CHECK: movss xmm0,DWORD PTR [{{.*}}-0x80000000] |
148 } | 150 } |
OLD | NEW |