Revision cab565c4 target-arm/neon_helper.c

b/target-arm/neon_helper.c
1802 1802
    return float32_val(float32_mul(make_float32(a), make_float32(b), NFS));
1803 1803
}
1804 1804

  
1805
/* Floating point comparisons produce an integer result.  */
1806
#define NEON_VOP_FCMP(name, ok) \
1807
uint32_t HELPER(neon_##name)(uint32_t a, uint32_t b) \
1808
{ \
1809
    switch (float32_compare_quiet(make_float32(a), make_float32(b), NFS)) { \
1810
    ok return ~0; \
1811
    default: return 0; \
1812
    } \
1805
/* Floating point comparisons produce an integer result.
1806
 * Note that EQ doesn't signal InvalidOp for QNaNs but GE and GT do.
1807
 * Softfloat routines return 0/1, which we convert to the 0/-1 Neon requires.
1808
 */
1809
uint32_t HELPER(neon_ceq_f32)(uint32_t a, uint32_t b)
1810
{
1811
    return -float32_eq_quiet(make_float32(a), make_float32(b), NFS);
1812
}
1813

  
1814
uint32_t HELPER(neon_cge_f32)(uint32_t a, uint32_t b)
1815
{
1816
    return -float32_le(make_float32(b), make_float32(a), NFS);
1813 1817
}
1814 1818

  
1815
NEON_VOP_FCMP(ceq_f32, case float_relation_equal:)
1816
NEON_VOP_FCMP(cge_f32, case float_relation_equal: case float_relation_greater:)
1817
NEON_VOP_FCMP(cgt_f32, case float_relation_greater:)
1819
uint32_t HELPER(neon_cgt_f32)(uint32_t a, uint32_t b)
1820
{
1821
    return -float32_lt(make_float32(b), make_float32(a), NFS);
1822
}
1818 1823

  
1819 1824
uint32_t HELPER(neon_acge_f32)(uint32_t a, uint32_t b)
1820 1825
{
1821 1826
    float32 f0 = float32_abs(make_float32(a));
1822 1827
    float32 f1 = float32_abs(make_float32(b));
1823
    switch (float32_compare_quiet(f0, f1, NFS)) {
1824
    case float_relation_equal:
1825
    case float_relation_greater:
1826
        return ~0;
1827
    default:
1828
        return 0;
1829
    }
1828
    return -float32_le(f1, f0, NFS);
1830 1829
}
1831 1830

  
1832 1831
uint32_t HELPER(neon_acgt_f32)(uint32_t a, uint32_t b)
1833 1832
{
1834 1833
    float32 f0 = float32_abs(make_float32(a));
1835 1834
    float32 f1 = float32_abs(make_float32(b));
1836
    if (float32_compare_quiet(f0, f1, NFS) == float_relation_greater) {
1837
        return ~0;
1838
    }
1839
    return 0;
1835
    return -float32_lt(f1, f0, NFS);
1840 1836
}
1841 1837

  
1842 1838
#define ELEM(V, N, SIZE) (((V) >> ((N) * (SIZE))) & ((1ull << (SIZE)) - 1))

Also available in: Unified diff