xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/peep-test-2.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -verify-machineinstrs -march=x86 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; CHECK: testl
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; It's tempting to eliminate the testl instruction here and just use the
6*9880d681SAndroid Build Coastguard Worker; EFLAGS value from the incl, however it can't be known whether the add
7*9880d681SAndroid Build Coastguard Worker; will overflow, and if it does the incl would set OF, and the
8*9880d681SAndroid Build Coastguard Worker; subsequent setg would return true.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
11*9880d681SAndroid Build Coastguard Workertarget triple = "i386-apple-darwin9.6"
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine i32 @f(i32 %j) nounwind readnone {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker	%0 = add i32 %j, 1		; <i32> [#uses=1]
16*9880d681SAndroid Build Coastguard Worker	%1 = icmp sgt i32 %0, 0		; <i1> [#uses=1]
17*9880d681SAndroid Build Coastguard Worker	%2 = zext i1 %1 to i32		; <i32> [#uses=1]
18*9880d681SAndroid Build Coastguard Worker	ret i32 %2
19*9880d681SAndroid Build Coastguard Worker}
20