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