26 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-- -x86-asm-syntax=intel | FileCheck %s3 4;; X's live range extends beyond the shift, so the register allocator5;; cannot coalesce it with Y. Because of this, a copy needs to be6;; emitted before the shift to save the register value before it is7;; clobbered. However, this copy is not needed if the register8;; allocator turns the shift into an LEA. This also occurs for ADD.9 10; Check that the shift gets turned into an LEA.11 12@G = external dso_local global i32 ; <ptr> [#uses=1]13 14define i32 @test1(i32 %X) {15; CHECK-LABEL: test1:16; CHECK: # %bb.0:17; CHECK-NEXT: mov eax, dword ptr [esp + 4]18; CHECK-NEXT: lea ecx, [4*eax]19; CHECK-NEXT: mov dword ptr [G], ecx20; CHECK-NEXT: ret21 %Z = shl i32 %X, 2 ; <i32> [#uses=1]22 store volatile i32 %Z, ptr @G23 ret i32 %X24}25 26