1/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
2   Contributed by Embecosm on behalf of Adapteva, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14for more details.
15
16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23<http://www.gnu.org/licenses/>.  */
24
25#include "../epiphany-asm.h"
26
27	/* Assumptions: NaNs have all bits 10..30 and one of bit 0..9 set.
28			after sub: AC = ~Borrow.
29	   clobber: TMP0
30	   output: gt / gte indicates greater / greater or equal.  */
31
32	FSTAB (__gtesf2,T_INT)
33	.global SYM(__gtesf2)
34	.balign 4
35	HIDDEN_FUNC(__gtesf2)
36SYM(__gtesf2):
37#ifndef FLOAT_FORMAT_MOTOROLA
38	mov	TMP0,0xffff
39	movt	TMP0,0x7f
40	add	TMP0,TMP0,r0
41	eor	TMP0,TMP0,r0
42	blt	.Lret
43	mov	TMP0,0xffff
44	movt	TMP0,0x7f
45	add	TMP0,TMP0,r1
46#else
47	add	TMP0,r0,0x3ff; check for r0 NaN
48	eor	TMP0,TMP0,r0
49	blt	.Lret
50	add	TMP0,r1,0x3ff; check for r1 NaN
51#endif
52	eor	TMP0,TMP0,r1
53	blt	.Lret
54	and	TMP0,r0,r1
55	blt	.Lneg
56	orr	TMP0,r0,r1
57	lsl	TMP0,TMP0,1
58	beq	.Lret
59	sub	TMP0,r0,r1
60.Lret:
61	rts
62	.balign 4
63.Lneg:
64	sub	TMP0,r1,r0
65	rts
66	ENDFUNC(__gtesf2)
67