xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2012-05-17-TwoAddressBug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-macosx -pre-RA-sched=source | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Teach two-address pass to update the "source" map so it doesn't perform a
4*9880d681SAndroid Build Coastguard Worker; non-profitable commute using outdated info. The test case would still fail
5*9880d681SAndroid Build Coastguard Worker; because of poor pre-RA schedule. That will be fixed by MI scheduler.
6*9880d681SAndroid Build Coastguard Worker; rdar://11472010
7*9880d681SAndroid Build Coastguard Workerdefine i32 @t(i32 %mask) nounwind readnone ssp {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t:
10*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: mov
11*9880d681SAndroid Build Coastguard Worker  %sub = add i32 %mask, -65535
12*9880d681SAndroid Build Coastguard Worker  %shr = lshr i32 %sub, 23
13*9880d681SAndroid Build Coastguard Worker  %and = and i32 %mask, 1
14*9880d681SAndroid Build Coastguard Worker  %add = add i32 %shr, %and
15*9880d681SAndroid Build Coastguard Worker  ret i32 %add
16*9880d681SAndroid Build Coastguard Worker}
17