Home | History | Annotate | Download | only in b14811006-GOT_PREL-optimization
      1 # Check if ARM compiler optimize GOT using GOT_PREL as much
      2 # as possible, and turn instruction sequence of SkAlphaMulQ()
      3 #
      4 #	ldr	r3, .L2
      5 #	ldr	r2, .L2+4
      6 #   .LPIC0:
      7 #	add	r3, pc, r3
      8 #	ldr	r3, [r3, r2]
      9 #	ldr	r3, [r3]
     10 #	and	r2, r3, r0, lsr #8
     11 #	....
     12 #   .L2:
     13 #	.word	_GLOBAL_OFFSET_TABLE_-(.LPIC0+8)
     14 #	.word	gMask_00FF00FF(GOT)
     15 #
     16 # into
     17 #
     18 #	ldr	r2, .L2
     19 #   .LPIC1:
     20 #	ldr	r2, [pc, r2]
     21 #	ldr	r3, [r2, #0]
     22 #	and	r2, r3, r0, lsr #8
     23 #	....
     24 #   .L2:
     25 #	.word	gMask_00FF00FF(GOT_PREL)+(.-(.LPIC1+8))
     26 #
     27 
     28 fail_panic ()
     29 {
     30     if [ $? != 0 ] ; then
     31         echo "ERROR: $@"
     32         exit 1
     33     fi
     34 }
     35 
     36 for opt do
     37     optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
     38     case "$opt" in
     39     APP_ABI=*)
     40         APP_ABI=$optarg
     41         ;;
     42     esac
     43 done
     44 
     45 if [ -z "$APP_ABI" -o "$APP_ABI" = "all" ]; then
     46     APP_ABI="armeabi,armeabi-v7a"
     47 fi
     48 
     49 # Only test for armeabi and armeabi-v7a
     50 if [ "$APP_ABI" != "${APP_ABI%%armeabi*}" ]; then
     51     APP_ABI=`echo $APP_ABI | tr ',' ' '`
     52     for ABI in $APP_ABI; do
     53         $NDK/ndk-build -B APP_ABI=$ABI APP_CFLAGS=-save-temps
     54         fail_panic "can't compile for APP_ABI=$ABI"
     55         fgrep -q "(GOT_PREL)" SkAlphaMulQ.s
     56         fail_panic "Fail to optimize GOT access with GOT_PREL, ABI=$ABI."
     57     done
     58 fi
     59 
     60 rm -rf libs obj SkAlphaMulQ.*