2007-04-17 01:36:08 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah
|
2006-12-02 12:23:10 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=pentium
|
2004-03-31 05:21:14 +08:00
|
|
|
|
|
|
|
bool %boolSel(bool %A, bool %B, bool %C) {
|
|
|
|
%X = select bool %A, bool %B, bool %C
|
|
|
|
ret bool %X
|
|
|
|
}
|
|
|
|
|
|
|
|
sbyte %byteSel(bool %A, sbyte %B, sbyte %C) {
|
|
|
|
%X = select bool %A, sbyte %B, sbyte %C
|
|
|
|
ret sbyte %X
|
|
|
|
}
|
|
|
|
|
|
|
|
short %shortSel(bool %A, short %B, short %C) {
|
|
|
|
%X = select bool %A, short %B, short %C
|
|
|
|
ret short %X
|
|
|
|
}
|
|
|
|
|
|
|
|
int %intSel(bool %A, int %B, int %C) {
|
|
|
|
%X = select bool %A, int %B, int %C
|
|
|
|
ret int %X
|
|
|
|
}
|
|
|
|
|
|
|
|
long %longSel(bool %A, long %B, long %C) {
|
|
|
|
%X = select bool %A, long %B, long %C
|
|
|
|
ret long %X
|
|
|
|
}
|
|
|
|
|
|
|
|
double %doubleSel(bool %A, double %B, double %C) {
|
|
|
|
%X = select bool %A, double %B, double %C
|
|
|
|
ret double %X
|
|
|
|
}
|
|
|
|
|
2004-03-31 06:37:04 +08:00
|
|
|
sbyte %foldSel(bool %A, sbyte %B, sbyte %C) {
|
|
|
|
%Cond = setlt sbyte %B, %C
|
|
|
|
%X = select bool %Cond, sbyte %B, sbyte %C
|
|
|
|
ret sbyte %X
|
|
|
|
}
|
|
|
|
|
|
|
|
int %foldSel2(bool %A, int %B, int %C) {
|
|
|
|
%Cond = seteq int %B, %C
|
|
|
|
%X = select bool %Cond, int %B, int %C
|
|
|
|
ret int %X
|
|
|
|
}
|
|
|
|
|
2007-01-31 00:16:01 +08:00
|
|
|
int %foldSel2a(bool %A, int %B, int %C, double %X, double %Y) {
|
2004-03-31 06:37:04 +08:00
|
|
|
%Cond = setlt double %X, %Y
|
|
|
|
%X = select bool %Cond, int %B, int %C
|
|
|
|
ret int %X
|
|
|
|
}
|
|
|
|
|
2004-04-01 11:47:56 +08:00
|
|
|
float %foldSel3(bool %A, float %B, float %C, uint %X, uint %Y) {
|
|
|
|
%Cond = setlt uint %X, %Y
|
|
|
|
%X = select bool %Cond, float %B, float %C
|
|
|
|
ret float %X
|
|
|
|
}
|
|
|
|
|
|
|
|
float %nofoldSel4(bool %A, float %B, float %C, int %X, int %Y) {
|
|
|
|
; X86 doesn't have a cmov that reads the right flags for this!
|
|
|
|
%Cond = setlt int %X, %Y
|
|
|
|
%X = select bool %Cond, float %B, float %C
|
|
|
|
ret float %X
|
|
|
|
}
|
|
|
|
|