1; RUN: llc < %s -march=x86 | grep {movzbl %\[abcd\]h,} | count 7 2 3; Use h-register extract and zero-extend. 4 5define double @foo8(double* nocapture inreg %p, i32 inreg %x) nounwind readonly { 6 %t0 = lshr i32 %x, 8 7 %t1 = and i32 %t0, 255 8 %t2 = getelementptr double* %p, i32 %t1 9 %t3 = load double* %t2, align 8 10 ret double %t3 11} 12define float @foo4(float* nocapture inreg %p, i32 inreg %x) nounwind readonly { 13 %t0 = lshr i32 %x, 8 14 %t1 = and i32 %t0, 255 15 %t2 = getelementptr float* %p, i32 %t1 16 %t3 = load float* %t2, align 8 17 ret float %t3 18} 19define i16 @foo2(i16* nocapture inreg %p, i32 inreg %x) nounwind readonly { 20 %t0 = lshr i32 %x, 8 21 %t1 = and i32 %t0, 255 22 %t2 = getelementptr i16* %p, i32 %t1 23 %t3 = load i16* %t2, align 8 24 ret i16 %t3 25} 26define i8 @foo1(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly { 27 %t0 = lshr i32 %x, 8 28 %t1 = and i32 %t0, 255 29 %t2 = getelementptr i8* %p, i32 %t1 30 %t3 = load i8* %t2, align 8 31 ret i8 %t3 32} 33define i8 @bar8(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly { 34 %t0 = lshr i32 %x, 5 35 %t1 = and i32 %t0, 2040 36 %t2 = getelementptr i8* %p, i32 %t1 37 %t3 = load i8* %t2, align 8 38 ret i8 %t3 39} 40define i8 @bar4(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly { 41 %t0 = lshr i32 %x, 6 42 %t1 = and i32 %t0, 1020 43 %t2 = getelementptr i8* %p, i32 %t1 44 %t3 = load i8* %t2, align 8 45 ret i8 %t3 46} 47define i8 @bar2(i8* nocapture inreg %p, i32 inreg %x) nounwind readonly { 48 %t0 = lshr i32 %x, 7 49 %t1 = and i32 %t0, 510 50 %t2 = getelementptr i8* %p, i32 %t1 51 %t3 = load i8* %t2, align 8 52 ret i8 %t3 53} 54