1 %verify "executed" 2 %verify "basic lt, gt, eq */ 3 %verify "left arg NaN" 4 %verify "right arg NaN" 5 /* 6 * Compare two floating-point values. Puts 0, 1, or -1 into the 7 * destination register based on the results of the comparison. 8 * 9 * int compare(x, y) { 10 * if (x == y) { 11 * return 0; 12 * } else if (x < y) { 13 * return -1; 14 * } else if (x > y) { 15 * return 1; 16 * } else { 17 * return 1; 18 * } 19 * } 20 * 21 * On entry: 22 * r0 = &op1 [vBB] 23 * r1 = &op2 [vCC] 24 */ 25 /* op vAA, vBB, vCC */ 26 fldd d0, [r0] @ d0<- vBB 27 fldd d1, [r1] @ d1<- vCC 28 fcmpd d0, d1 @ compare (vBB, vCC) 29 mov r0, #1 @ r0<- 1 (default) 30 fmstat @ export status flags 31 mvnmi r0, #0 @ (less than) r0<- -1 32 moveq r0, #0 @ (equal) r0<- 0 33 bx lr 34