spu-gccの4.3.1でちょっと実験

#include 
#include 

int main()
{
	int i, number, total;
	char str[1024];

	fgets(str, sizeof(str), stdin);
	number = atoi(str);
	total = 0;
	for (i = 0; i < number; ++i) {
		total += i;
	}
	printf("%s, %d, %d\n", str, number, total);
	return 0;
}

って書いたのをtest.cで保存し、

spu-gcc -O3 test.c -S

とやると、こんなのが出てくる。

	.file	"test.c"
	.section	.rodata.str1.16,"aMS",@progbits,1
	.align	4
.LC0:
	.string	"%s, %d, %d\n"
	.section	.rodata.cst16,"aM",@progbits,16
	.align	4
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
.text
	.align	3
	.global	main
	.type	main, @function
main:
	il	$7,4
	hbrr	.L16,fgets
	nop	127
	lqr	$6,_impure_ptr
	il	$75,-1056
	stqd	$lr,16($sp)
	il	$4,1024
	stqd	$sp,-1056($sp)
	a	$sp,$sp,$75
	ai	$3,$sp,32
	a	$8,$6,$7
	lqx	$5,$6,$7
	rotqby	$5,$5,$8
.L16:
	brsl	$lr,fgets
	ai	$3,$sp,32
	brsl	$lr,atoi
	cgti	$2,$3,0
	ori	$8,$3,0
	nop	127
	brz	$2,.L12
	rotmi	$6,$3,-2
	hbrr	.L15,.L6
	clgti	$14,$3,3
	nor	$13,$14,$14
	shli	$7,$6,2
	sfi	$10,$13,0
	ceqi	$12,$7,0
	sfi	$11,$12,0
	or	$9,$10,$11
	ceqbi	$4,$9,0
	xsbh	$3,$4
	brhz	$3,.L13
	il	$3,0
	lqr	$5,.LC1
	il	$4,0
.L6:
	ai	$4,$4,1
	a	$3,$3,$5
	clgt	$15,$6,$4
	ai	$5,$5,4
.L15:
	brnz	$15,.L6
	ori	$22,$3,0
	hbrr	.L14,.L8
	nop	127
	rotqbyi	$21,$3,(1*4+0)%16
	ceq	$16,$8,$7
	rotqbyi	$20,$3,(2*4+0)%16
	rotqbyi	$18,$3,(3*4+0)%16
	a	$19,$21,$22
	a	$17,$19,$20
	lnop
	a	$6,$17,$18
	brnz	$16,.L3
.L8:
	a	$6,$6,$7
	ai	$7,$7,1
	cgt	$23,$8,$7
.L14:
	brnz	$23,.L8
.L3:
	ai	$4,$sp,32
	ori	$5,$8,0
	ila	$3,.LC0
	brsl	$lr,printf
	il	$24,1056
	il	$3,0
	a	$sp,$sp,$24
	lqd	$lr,16($sp)
	nop	127
	bi	$lr
.L12:
	il	$6,0
	br	.L3
.L13:
	il	$6,0
	lnop
	il	$7,0
	br	.L8
	.size	main, .-main
	.ident	"GCC: (GNU) 4.3.1"

比較対象に出来るはずの4.1.1の結果がないのでなんとも断言できないが、多分.L15あたりが4.3で-O3標準採用となったベクタライズの威力かな?よくよく考えてみるとスカラコードのCで、アセンブリ出力見たことないかもしれないなぁ。