1 ; RUN: llc -mtriple x86_64-linux -mcpu core2 -verify-machineinstrs %s -o - | FileCheck %s 2 define i32 @f(i1 %foo, i16* %tm_year2, i8* %bar, i16 %zed, i32 %zed2) { 3 entry: 4 br i1 %foo, label %return, label %if.end 5 6 if.end: 7 %rem = srem i32 %zed2, 100 8 %conv3 = trunc i32 %rem to i16 9 store i16 %conv3, i16* %tm_year2 10 %sext = shl i32 %rem, 16 11 %conv5 = ashr exact i32 %sext, 16 12 %div = sdiv i32 %conv5, 10 13 %conv6 = trunc i32 %div to i8 14 store i8 %conv6, i8* %bar 15 br label %return 16 17 return: 18 %retval.0 = phi i32 [ 0, %if.end ], [ -1, %entry ] 19 ret i32 %retval.0 20 } 21 22 ; We were miscompiling this and using %ax instead of %cx in the movw 23 ; in the following sequence: 24 ; movswl %cx, %ecx 25 ; movw %cx, (%rsi) 26 ; movslq %ecx, %rcx 27 ; 28 ; We can't produce the above sequence without special SD-level 29 ; heuristics. Now we produce this: 30 ; CHECK: movw %ax, (%rsi) 31 ; CHECK: cwtl 32 ; CHECK: cltq 33