fix a missing shuffle pattern, PR9009. Patch by Artiom Myaskouvskey!
[oota-llvm.git] / test / CodeGen / X86 / fast-isel-gep.ll
index 577dd7223a4d7a9464f805c5d44d337bb2b6e5ad..622a1ff831d03a703bd1d48e33e0c895c791c246 100644 (file)
@@ -70,3 +70,20 @@ entry:
 ; X64: test4:
 ; X64: 128(%r{{.*}},%r{{.*}},8)
 }
+
+; PR8961 - Make sure the sext for the GEP addressing comes before the load that
+; is folded.
+define i64 @test5(i8* %A, i32 %I, i64 %B) nounwind {
+  %v8 = getelementptr i8* %A, i32 %I
+  %v9 = bitcast i8* %v8 to i64*
+  %v10 = load i64* %v9
+  %v11 = add i64 %B, %v10
+  ret i64 %v11
+; X64: test5:
+; X64: movslq  %esi, %rax
+; X64-NEXT: movq       (%rdi,%rax), %rax
+; X64-NEXT: addq       %rdx, %rax
+; X64-NEXT: ret
+}
+
+