1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- -mattr=-bmi | FileCheck %s
3
4; Use h-register extract and zero-extend.
5
6define double @foo8(double* nocapture inreg %p, i32 inreg %x) nounwind readonly {
7; CHECK-LABEL: foo8:
8; CHECK:       # %bb.0:
9; CHECK-NEXT:    movzbl %dh, %ecx
10; CHECK-NEXT:    fldl (%eax,%ecx,8)
11; CHECK-NEXT:    retl
12  %t0 = lshr i32 %x, 8
13  %t1 = and i32 %t0, 255
14  %t2 = getelementptr double, double* %p, i32 %t1
15  %t3 = load double, double* %t2, align 8
16  ret double %t3
17}
18
19define float @foo4(float* nocapture inreg %p, i32 inreg %x) nounwind readonly {
20; CHECK-LABEL: foo4:
21; CHECK:       # %bb.0:
22; CHECK-NEXT:    movzbl %dh, %ecx
23; CHECK-NEXT:    flds (%eax,%ecx,4)
24; CHECK-NEXT:    retl
25  %t0 = lshr i32 %x, 8
26  %t1 = and i32 %t0, 255
27  %t2 = getelementptr float, float* %p, i32 %t1
28  %t3 = load float, float* %t2, align 8
29  ret float %t3
30}
31
32define i16 @foo2(i16* nocapture inreg %p, i32 inreg %x) nounwind readonly {
33; CHECK-LABEL: foo2:
34; CHECK:       # %bb.0:
35; CHECK-NEXT:    movzbl %dh, %ecx
36; CHECK-NEXT:    movzwl (%eax,%ecx,2), %eax
37; CHECK-NEXT:    retl
38  %t0 = lshr i32 %x, 8
39  %t1 = and i32 %t0, 255
40  %t2 = getelementptr i16, i16* %p, i32 %t1
41  %t3 = load i16, i16* %t2, align 8
42  ret i16 %t3
43}
44
45define i8 @foo1(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly {
46; CHECK-LABEL: foo1:
47; CHECK:       # %bb.0:
48; CHECK-NEXT:    movzbl %dh, %ecx
49; CHECK-NEXT:    movb (%eax,%ecx), %al
50; CHECK-NEXT:    retl
51  %t0 = lshr i32 %x, 8
52  %t1 = and i32 %t0, 255
53  %t2 = getelementptr i8, i8* %p, i32 %t1
54  %t3 = load i8, i8* %t2, align 8
55  ret i8 %t3
56}
57
58define i8 @bar8(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly {
59; CHECK-LABEL: bar8:
60; CHECK:       # %bb.0:
61; CHECK-NEXT:    movzbl %dh, %ecx
62; CHECK-NEXT:    movb (%eax,%ecx,8), %al
63; CHECK-NEXT:    retl
64  %t0 = lshr i32 %x, 5
65  %t1 = and i32 %t0, 2040
66  %t2 = getelementptr i8, i8* %p, i32 %t1
67  %t3 = load i8, i8* %t2, align 8
68  ret i8 %t3
69}
70
71define i8 @bar4(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly {
72; CHECK-LABEL: bar4:
73; CHECK:       # %bb.0:
74; CHECK-NEXT:    movzbl %dh, %ecx
75; CHECK-NEXT:    movb (%eax,%ecx,4), %al
76; CHECK-NEXT:    retl
77  %t0 = lshr i32 %x, 6
78  %t1 = and i32 %t0, 1020
79  %t2 = getelementptr i8, i8* %p, i32 %t1
80  %t3 = load i8, i8* %t2, align 8
81  ret i8 %t3
82}
83
84define i8 @bar2(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly {
85; CHECK-LABEL: bar2:
86; CHECK:       # %bb.0:
87; CHECK-NEXT:    movzbl %dh, %ecx
88; CHECK-NEXT:    movb (%eax,%ecx,2), %al
89; CHECK-NEXT:    retl
90  %t0 = lshr i32 %x, 7
91  %t1 = and i32 %t0, 510
92  %t2 = getelementptr i8, i8* %p, i32 %t1
93  %t3 = load i8, i8* %t2, align 8
94  ret i8 %t3
95}
96