30 lines · plain
1; RUN: llc < %s -mtriple=i686-- | FileCheck %s2 3; When doing sign extension, use the sext-load lowering to take advantage of4; x86's sign extension during loads.5;6; CHECK-LABEL: test1:7; CHECK: movsbl {{.*}}, %eax8; CHECK-NEXT: ret9define 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 %tmp12314}15 16; When using a sextload representation, ensure that the sign extension is17; preserved even when removing shifted-out low bits.18;19; CHECK-LABEL: test2:20; CHECK: movswl {{.*}}, %eax21; CHECK-NEXT: ret22define i32 @test2(ptr %this) {23entry:24 %b48 = getelementptr inbounds { i16, [6 x i8] }, ptr %this, i32 0, i32 125 %bf.load = load i48, ptr %b48, align 226 %bf.ashr = ashr i48 %bf.load, 3227 %bf.cast = trunc i48 %bf.ashr to i3228 ret i32 %bf.cast29}30