1/* Tests some basic unordered fpu compare instructions. 2 3 Copyright (C) 2019-2023 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 18# mach: or1k 19# output: report(0x40490fd0);\n 20# output: report(0x402df84d);\n 21# output: report(0x7fc00000);\n 22# output: \n 23# output: report(0x00000001);\n 24# output: \n 25# output: report(0x00000000);\n 26# output: \n 27# output: report(0x00000001);\n 28# output: \n 29# output: report(0x00000001);\n 30# output: \n 31# output: exit(0)\n 32 33#include "or1k-asm-test-helpers.h" 34 35 STANDARD_TEST_ENVIRONMENT 36 37 .section .data 38 .align 4 39 .type pi, @object 40 .size pi, 4 41anchor: 42pi: 43 .float 3.14159 44 45 .type e, @object 46 .size e, 4 47e: 48 .float 2.71828 49 50 .section .text 51start_tests: 52 PUSH LINK_REGISTER_R9 53 54 /* Test unordered float comparisons. Setting up: 55 * r11 pointer to data 56 * r12 pi as float 57 * r13 e as float 58 * r16 nan as float 59 */ 60 l.ori r11, r0, ha(anchor) 61 l.addi r11, r11, lo(anchor) 62 l.lwz r12, 0(r11) 63 64 l.lwz r13, 4(r11) 65 66 /* Make a NaN. */ 67 lf.sub.s r16, r13, r13 68 lf.div.s r16, r16, r16 69 70 /* Output to ensure we loaded it correctly. */ 71 REPORT_REG_TO_CONSOLE r12 72 REPORT_REG_TO_CONSOLE r13 73 REPORT_REG_TO_CONSOLE r16 74 PRINT_NEWLINE_TO_CONSOLE 75 76 lf.sfuge.s r12, r13 77 MOVE_FROM_SPR r2, SPR_SR 78 REPORT_BIT_TO_CONSOLE r2, SPR_SR_F 79 PRINT_NEWLINE_TO_CONSOLE 80 81 lf.sfun.s r12, r13 82 MOVE_FROM_SPR r2, SPR_SR 83 REPORT_BIT_TO_CONSOLE r2, SPR_SR_F 84 PRINT_NEWLINE_TO_CONSOLE 85 86 lf.sfun.s r12, r16 87 MOVE_FROM_SPR r2, SPR_SR 88 REPORT_BIT_TO_CONSOLE r2, SPR_SR_F 89 PRINT_NEWLINE_TO_CONSOLE 90 91 lf.sfueq.s r12, r12 92 MOVE_FROM_SPR r2, SPR_SR 93 REPORT_BIT_TO_CONSOLE r2, SPR_SR_F 94 PRINT_NEWLINE_TO_CONSOLE 95 96 POP LINK_REGISTER_R9 97 RETURN_TO_LINK_REGISTER_R9 98