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 * On entry: 21 * r0 = &op1 [vBB] 22 * r1 = &op2 [vCC] 23 */ 24 /* op vAA, vBB, vCC */ 25 fldd d0, [r0] @ d0<- vBB 26 fldd d1, [r1] @ d1<- vCC 27 fcmped d0, d1 @ compare (vBB, vCC) 28 mvn r0, #0 @ r0<- -1 (default) 29 fmstat @ export status flags 30 movgt r0, #1 @ (greater than) r0<- 1 31 moveq r0, #0 @ (equal) r0<- 0 32 bx lr 33