1 //===----------------------Hexagon builtin routine ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
15 #define Q6_ALIAS(TAG) .global __qdsp_##TAG ; .set __qdsp_##TAG, __hexagon_##TAG
16 #define END(TAG) .size TAG,.-TAG
19 * Min and Max return A if B is NaN, or B if A is NaN
20 * Otherwise, they return the smaller or bigger value
22 * If values are equal, we want to favor -0.0 for min and +0.0 for max.
26 * Compares always return false for NaN
27 * if (isnan(A)) A = B; if (A > B) A = B will only trigger at most one of those options.
30 .global __hexagon_mindf3
31 .global __hexagon_maxdf3
36 .type __hexagon_mindf3,@function
37 .type __hexagon_maxdf3,@function
44 p0 = dfclass(A,#0x10) // If A is a number
45 p1 = dfcmp.gt(A,B) // AND B > A, don't swap
49 if (p0) A = B // if A is NaN use B
50 if (p1) A = B // gt is always false if either is NaN
51 p2 = dfcmp.eq(A,B) // if A == B
52 if (!p2.new) jumpr:t r31
54 /* A == B, return A|B to select -0.0 over 0.0 */
72 if (!p2.new) jumpr:t r31
74 /* A == B, return A&B to select 0.0 over -0.0 */