Thomas Gleixner | 588cb88 | 2019-05-23 11:14:57 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Palmer Dabbelt | b35cd98 | 2017-05-23 10:28:26 -0700 | [diff] [blame] | 2 | /* |
Palmer Dabbelt | b35cd98 | 2017-05-23 10:28:26 -0700 | [diff] [blame] | 3 | */ |
| 4 | |
| 5 | #include <linux/export.h> |
| 6 | |
Christoph Hellwig | 4db2b60 | 2017-11-22 11:47:28 +0100 | [diff] [blame] | 7 | #include <linux/libgcc.h> |
Palmer Dabbelt | b35cd98 | 2017-05-23 10:28:26 -0700 | [diff] [blame] | 8 | |
| 9 | word_type notrace __cmpdi2(long long a, long long b) |
| 10 | { |
| 11 | const DWunion au = { |
| 12 | .ll = a |
| 13 | }; |
| 14 | const DWunion bu = { |
| 15 | .ll = b |
| 16 | }; |
| 17 | |
| 18 | if (au.s.high < bu.s.high) |
| 19 | return 0; |
| 20 | else if (au.s.high > bu.s.high) |
| 21 | return 2; |
| 22 | |
| 23 | if ((unsigned int) au.s.low < (unsigned int) bu.s.low) |
| 24 | return 0; |
| 25 | else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) |
| 26 | return 2; |
| 27 | |
| 28 | return 1; |
| 29 | } |
| 30 | EXPORT_SYMBOL(__cmpdi2); |