xref: /minix3/sys/external/bsd/compiler_rt/dist/test/builtins/timing/time (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc#!/bin/sh
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambucfunction test () {
4*0a6a1f1dSLionel Sambuc    arch=$1
5*0a6a1f1dSLionel Sambuc    file=$2
6*0a6a1f1dSLionel Sambuc    name=$3
7*0a6a1f1dSLionel Sambuc    ldflags=$4
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc    if gcc -arch $arch -Os $file $ldflags -DLIBNAME=$name
10*0a6a1f1dSLionel Sambuc    then
11*0a6a1f1dSLionel Sambuc	if ./a.out
12*0a6a1f1dSLionel Sambuc	then
13*0a6a1f1dSLionel Sambuc	    rm ./a.out
14*0a6a1f1dSLionel Sambuc	else
15*0a6a1f1dSLionel Sambuc	    echo "fail"
16*0a6a1f1dSLionel Sambuc	fi
17*0a6a1f1dSLionel Sambuc    else
18*0a6a1f1dSLionel Sambuc	echo "$FILE failed to compile"
19*0a6a1f1dSLionel Sambuc    fi
20*0a6a1f1dSLionel Sambuc}
21*0a6a1f1dSLionel Sambuc
22*0a6a1f1dSLionel SambucINSTALLED=/usr/local/lib/system/libcompiler_rt.a
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambucfor ARCH in i386 x86_64; do
25*0a6a1f1dSLionel Sambuc	for FILE in $(ls *.c); do
26*0a6a1f1dSLionel Sambuc
27*0a6a1f1dSLionel Sambuc		echo "Timing $FILE for $ARCH"
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc		test $ARCH $FILE libgcc ""
30*0a6a1f1dSLionel Sambuc                test $ARCH $FILE tuned ../../darwin_fat/Release/libcompiler_rt.a
31*0a6a1f1dSLionel Sambuc                if [ -f "$INSTALLED" ]; then
32*0a6a1f1dSLionel Sambuc                    test $ARCH $FILE installed $INSTALLED
33*0a6a1f1dSLionel Sambuc		fi
34*0a6a1f1dSLionel Sambuc
35*0a6a1f1dSLionel Sambuc		echo " "
36*0a6a1f1dSLionel Sambuc
37*0a6a1f1dSLionel Sambuc	done
38*0a6a1f1dSLionel Sambucdone
39*0a6a1f1dSLionel Sambucexit
40