1; RUN: llc < %s -mtriple=i686-- | FileCheck %s 2 3; When doing sign extension, use the sext-load lowering to take advantage of 4; x86's sign extension during loads. 5; 6; CHECK-LABEL: test1: 7; CHECK: movsbl {{.*}}, %eax 8; CHECK-NEXT: ret 9define i32 @test1(i32 %X) nounwind { 10entry: 11 %tmp12 = trunc i32 %X to i8 ; <i8> [#uses=1] 12 %tmp123 = sext i8 %tmp12 to i32 ; <i32> [#uses=1] 13 ret i32 %tmp123 14} 15 16; When using a sextload representation, ensure that the sign extension is 17; preserved even when removing shifted-out low bits. 18; 19; CHECK-LABEL: test2: 20; CHECK: movswl {{.*}}, %eax 21; CHECK-NEXT: ret 22define i32 @test2(ptr %this) { 23entry: 24 %b48 = getelementptr inbounds { i16, [6 x i8] }, ptr %this, i32 0, i32 1 25 %bf.load = load i48, ptr %b48, align 2 26 %bf.ashr = ashr i48 %bf.load, 32 27 %bf.cast = trunc i48 %bf.ashr to i32 28 ret i32 %bf.cast 29} 30