Plain Text Paste by SnakE
Description: Comparison of VCExpress and GDC code generation
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | ; Microsoft ; Vec unitise(const Vec &a) { return (1 / sqrt(dot(a, a))) * a; } 000000b0 <?unitise@@YA?AUVec@@ABU1@@Z>: b0: 56 push %esi b1: 8b 74 24 0c mov 0xc(%esp),%esi ; &a => esi b5: dd 46 08 fldl 0x8(%esi) ; a.y \ b8: dd 06 fldl (%esi) ; a.y, a.x | ba: dd 46 10 fldl 0x10(%esi) ; a.y, a.x, a.z | bd: d9 c1 fld %st(1) ; a.y, a.x, a.z, a.x | bf: de ca fmulp %st,%st(2) ; a.y, a.x*a.x, a.z | c1: d9 c2 fld %st(2) ; a.y, a.x*a.x, a.z, a.y | dot() inlined c3: de cb fmulp %st,%st(3) ; a.y*a.y, a.x*a.x, a.z | c5: d9 c9 fxch %st(1) ; a.y*a.y, a.z, a.x*a.x | c7: de c2 faddp %st,%st(2) ; a.y*a.y+a.x*a.x, a.z | c9: dc c8 fmul %st,%st(0) ; a.y*a.y+a.x*a.x, a.z*a.z | cb: de c1 faddp %st,%st(1) ; a.y*a.y+a.x*a.x+a.z*a.z / cd: e8 00 00 00 00 call d2 <?unitise@@YA?AUVec@@ABU1@@Z+0x22> ; sqrt(dot) d2: d9 e8 fld1 ; sqrt, 1 d4: de f1 fdivp %st,%st(1) ; 1/sqrt d6: 8b 44 24 08 mov 0x8(%esp),%eax ; &res => eax da: dd 06 fldl (%esi) ; 1/sqrt, a.x dc: d8 c9 fmul %st(1),%st ; 1/sqrt, a.x*1/sqrt de: dd 18 fstpl (%eax) ; 1/sqrt ; a.x*1/sqrt => res.x e0: d9 c0 fld %st(0) ; 1/sqrt, 1/sqrt e2: dc 4e 08 fmull 0x8(%esi) ; 1/sqrt, 1/sqrt*a.y e5: dd 58 08 fstpl 0x8(%eax) ; 1/sqrt ; 1/sqrt*a.y => res.y e8: dc 4e 10 fmull 0x10(%esi) ; 1/sqrt*a.z eb: 5e pop %esi ec: dd 58 10 fstpl 0x10(%eax) ; ; 1/sqrt*a.z => res.z ef: c3 ret ; GDC ; Vec unitise() { return opMul(1f / sqrt(dot(*this))); } 00000000 <_D9tracetest3Vec7unitiseMFZS9tracetest3Vec>: 0: 56 push %esi 1: 53 push %ebx 2: 83 ec 24 sub $0x24,%esp 5: 8b 5c 24 34 mov 0x34(%esp),%ebx ; this => ebx 9: 8b 74 24 30 mov 0x30(%esp),%esi ; &res => esi d: 85 db test %ebx,%ebx f: 74 51 je 62 <_D9tracetest3Vec7unitiseMFZS9tracetest3Vec+0x62> ; this == null, raise an exception ? 11: dd 03 fldl (%ebx) ; x \ 13: dd 43 08 fldl 0x8(%ebx) ; x, y | 16: d9 c9 fxch %st(1) ; y, x | 18: d8 c8 fmul %st(0),%st ; y, x*x | 1a: d9 c9 fxch %st(1) ; x*x, y | dot() inlined 1c: d8 c8 fmul %st(0),%st ; x*x, y*y | 1e: de c1 faddp %st,%st(1) ; x*x+y*y | 20: dd 43 10 fldl 0x10(%ebx) ; x*x+y*y, z | 23: d8 c8 fmul %st(0),%st ; x*x+y*y, z*z | 25: de c1 faddp %st,%st(1) ; x*x+y*y+z*z / 27: dd 1c 24 fstpl (%esp) ; dot => esp[0..8] 2a: e8 00 00 00 00 call 2f <_D9tracetest3Vec7unitiseMFZS9tracetest3Vec+0x2f> ; sqrt(dot) 2f: dc 3d 30 00 00 00 fdivrl 0x30 ; 1/sqrt (?) \ 35: dd 43 10 fldl 0x10(%ebx) ; 1/sqrt, z | 38: d8 c9 fmul %st(1),%st ; 1/sqrt, z*1/sqrt | 3a: dd 5c 24 14 fstpl 0x14(%esp) ; 1/sqrt ; z*1/sqrt => esp[20..28] | 3e: dd 43 08 fldl 0x8(%ebx) ; 1/sqrt, y | opMul() inlined 41: d8 c9 fmul %st(1),%st ; 1/sqrt, y*1/sqrt | 43: dd 5c 24 0c fstpl 0xc(%esp) ; 1/sqrt ; y*1/sqrt => esp[12..20] | 47: dc 0b fmull (%ebx) ; 1/sqrt*x | 49: 89 34 24 mov %esi,(%esp) ; &res => esp[0..4] | 4c: dd 5c 24 04 fstpl 0x4(%esp) ; 1/sqrt*x => esp[4..12] / 50: e8 7b 13 00 00 call 13d0 <_D9tracetest3Vec6opCallFdddZS9tracetest3Vec> ; Vec.opCall() 55: 83 ec 04 sub $0x4,%esp 58: 89 f0 mov %esi,%eax 5a: 83 c4 24 add $0x24,%esp 5d: 5b pop %ebx 5e: 5e pop %esi 5f: c2 04 00 ret $0x4 ; Exception handling goes here ? 62: ba 0e 00 00 00 mov $0xe,%edx 67: b9 18 00 00 00 mov $0x18,%ecx 6c: b8 07 00 00 00 mov $0x7,%eax 71: 89 54 24 10 mov %edx,0x10(%esp) 75: ba 09 00 00 00 mov $0x9,%edx 7a: 89 4c 24 0c mov %ecx,0xc(%esp) 7e: b9 20 00 00 00 mov $0x20,%ecx 83: 89 44 24 08 mov %eax,0x8(%esp) 87: 89 14 24 mov %edx,(%esp) 8a: 89 4c 24 04 mov %ecx,0x4(%esp) 8e: e8 00 00 00 00 call 93 <_D9tracetest3Vec7unitiseMFZS9tracetest3Vec+0x93> 93: b8 0d 00 00 00 mov $0xd,%eax 98: ba 07 00 00 00 mov $0x7,%edx 9d: b9 18 00 00 00 mov $0x18,%ecx a2: 89 44 24 10 mov %eax,0x10(%esp) a6: b8 09 00 00 00 mov $0x9,%eax ab: 89 54 24 08 mov %edx,0x8(%esp) af: ba 20 00 00 00 mov $0x20,%edx b4: 89 4c 24 0c mov %ecx,0xc(%esp) b8: 89 04 24 mov %eax,(%esp) bb: 89 54 24 04 mov %edx,0x4(%esp) bf: e8 00 00 00 00 call c4 <_D9tracetest3Vec7unitiseMFZS9tracetest3Vec+0xc4> c4: e9 48 ff ff ff jmp 11 <_D9tracetest3Vec7unitiseMFZS9tracetest3Vec+0x11> c9: 8d b4 26 00 00 00 00 lea 0x0(%esi),%esi |