429 lines · c
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.2// See https://llvm.org/LICENSE.txt for license information.3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception4 5// RUN: %clang_builtins %s %librt -o %t && %run %t6// REQUIRES: librt_has_divsf37 8#include "int_lib.h"9#include <inttypes.h>10#include <stdio.h>11 12#include "fp_test.h"13 14// By default this test uses compareResultF to check the returned floats, which15// accepts any returned NaN if the expected result is the canonical NaN value16// 0x7fc00000. For the Arm optimized FP implementation, which commits to a more17// detailed handling of NaNs, we tighten up the check and include some extra18// test cases specific to that NaN policy.19#if (__arm__ && !(__thumb__ && !__thumb2__)) && COMPILER_RT_ARM_OPTIMIZED_FP20# define EXPECT_EXACT_RESULTS21# define ARM_NAN_HANDLING22#endif23 24// Returns: a / b25COMPILER_RT_ABI float __divsf3(float a, float b);26 27int test__divsf3(uint32_t a_rep, uint32_t b_rep, uint32_t expected_rep) {28 float a = fromRep32(a_rep), b = fromRep32(b_rep);29 float x = __divsf3(a, b);30#ifdef EXPECT_EXACT_RESULTS31 int ret = toRep32(x) == expected_rep;32#else33 int ret = compareResultF(x, expected_rep);34#endif35 36 if (ret) {37 printf("error in test__divsf3(%08" PRIx32 ", %08" PRIx32 ") = %08" PRIx3238 ", expected %08" PRIx32 "\n",39 a_rep, b_rep, toRep32(x), expected_rep);40 }41 return ret;42}43 44int main(void) {45 int status = 0;46 47 status |= test__divsf3(0x00000000, 0x00000001, 0x00000000);48 status |= test__divsf3(0x00000000, 0x007fffff, 0x00000000);49 status |= test__divsf3(0x00000000, 0x00800000, 0x00000000);50 status |= test__divsf3(0x00000000, 0x00ffffff, 0x00000000);51 status |= test__divsf3(0x00000000, 0x3f800000, 0x00000000);52 status |= test__divsf3(0x00000000, 0x40a00000, 0x00000000);53 status |= test__divsf3(0x00000000, 0x7effffff, 0x00000000);54 status |= test__divsf3(0x00000000, 0x7f000000, 0x00000000);55 status |= test__divsf3(0x00000000, 0x7f800000, 0x00000000);56 status |= test__divsf3(0x00000000, 0x80000002, 0x80000000);57 status |= test__divsf3(0x00000000, 0x807fffff, 0x80000000);58 status |= test__divsf3(0x00000000, 0x80800001, 0x80000000);59 status |= test__divsf3(0x00000000, 0x81000000, 0x80000000);60 status |= test__divsf3(0x00000000, 0xc0400000, 0x80000000);61 status |= test__divsf3(0x00000000, 0xc0e00000, 0x80000000);62 status |= test__divsf3(0x00000000, 0xfe7fffff, 0x80000000);63 status |= test__divsf3(0x00000000, 0xff000000, 0x80000000);64 status |= test__divsf3(0x00000000, 0xff800000, 0x80000000);65 status |= test__divsf3(0x00000001, 0x00000000, 0x7f800000);66 status |= test__divsf3(0x00000001, 0x3e000000, 0x00000008);67 status |= test__divsf3(0x00000001, 0x3f000000, 0x00000002);68 status |= test__divsf3(0x00000001, 0x40000000, 0x00000000);69 status |= test__divsf3(0x00000001, 0x7f7fffff, 0x00000000);70 status |= test__divsf3(0x00000001, 0x7f800000, 0x00000000);71 status |= test__divsf3(0x00000001, 0xc0000000, 0x80000000);72 status |= test__divsf3(0x00000001, 0xff7fffff, 0x80000000);73 status |= test__divsf3(0x00000002, 0x80000000, 0xff800000);74 status |= test__divsf3(0x00000002, 0xff800000, 0x80000000);75 status |= test__divsf3(0x00000009, 0x41100000, 0x00000001);76 status |= test__divsf3(0x00000009, 0xc1100000, 0x80000001);77 status |= test__divsf3(0x007ffff7, 0x3f7ffffe, 0x007ffff8);78 status |= test__divsf3(0x007ffffe, 0x3f7ffffe, 0x007fffff);79 status |= test__divsf3(0x007fffff, 0x00000000, 0x7f800000);80 status |= test__divsf3(0x007fffff, 0x3b000000, 0x04fffffe);81 status |= test__divsf3(0x007fffff, 0x3f000000, 0x00fffffe);82 status |= test__divsf3(0x007fffff, 0x3f800000, 0x007fffff);83 status |= test__divsf3(0x007fffff, 0x3f800002, 0x007ffffd);84 status |= test__divsf3(0x007fffff, 0x7f800000, 0x00000000);85 status |= test__divsf3(0x007fffff, 0x80000000, 0xff800000);86 status |= test__divsf3(0x007fffff, 0xbf800000, 0x807fffff);87 status |= test__divsf3(0x007fffff, 0xff800000, 0x80000000);88 status |= test__divsf3(0x00800000, 0x00000000, 0x7f800000);89 status |= test__divsf3(0x00800000, 0x3f800001, 0x007fffff);90 status |= test__divsf3(0x00800000, 0x7f800000, 0x00000000);91 status |= test__divsf3(0x00800001, 0x3f800002, 0x007fffff);92 status |= test__divsf3(0x00800001, 0x80000000, 0xff800000);93 status |= test__divsf3(0x00800001, 0xff800000, 0x80000000);94 status |= test__divsf3(0x00800002, 0x3f800006, 0x007ffffc);95 status |= test__divsf3(0x00fffffe, 0x40000000, 0x007fffff);96 status |= test__divsf3(0x00ffffff, 0x00000000, 0x7f800000);97 status |= test__divsf3(0x00ffffff, 0x40000000, 0x00800000);98 status |= test__divsf3(0x00ffffff, 0x7f800000, 0x00000000);99 status |= test__divsf3(0x01000000, 0x00800000, 0x40000000);100 status |= test__divsf3(0x01000000, 0x80000000, 0xff800000);101 status |= test__divsf3(0x01000000, 0xc0000000, 0x80800000);102 status |= test__divsf3(0x01000000, 0xff800000, 0x80000000);103 status |= test__divsf3(0x01000001, 0x00800001, 0x40000000);104 status |= test__divsf3(0x01000001, 0xc0000000, 0x80800001);105 status |= test__divsf3(0x01000003, 0x80800003, 0xc0000000);106 status |= test__divsf3(0x01000003, 0xc0000000, 0x80800003);107 status |= test__divsf3(0x3f7ffff7, 0x3f7ffffb, 0x3f7ffffc);108 status |= test__divsf3(0x3f7ffff7, 0x3f7ffffe, 0x3f7ffff9);109 status |= test__divsf3(0x3f7ffff8, 0x3f7ffffc, 0x3f7ffffc);110 status |= test__divsf3(0x3f7ffff8, 0x3f7ffffd, 0x3f7ffffb);111 status |= test__divsf3(0x3f7ffffa, 0x3f7ffff9, 0x3f800001);112 status |= test__divsf3(0x3f7ffffb, 0x3f7ffff9, 0x3f800001);113 status |= test__divsf3(0x3f7ffffc, 0x3f7ffff9, 0x3f800002);114 status |= test__divsf3(0x3f7ffffc, 0x3f7ffffd, 0x3f7fffff);115 status |= test__divsf3(0x3f7ffffc, 0x3f7ffffe, 0x3f7ffffe);116 status |= test__divsf3(0x3f7ffffc, 0x3f7fffff, 0x3f7ffffd);117 status |= test__divsf3(0x3f7ffffc, 0x3f800001, 0x3f7ffffa);118 status |= test__divsf3(0x3f7ffffd, 0x3f7ffff9, 0x3f800002);119 status |= test__divsf3(0x3f7ffffd, 0x3f7ffffc, 0x3f800001);120 status |= test__divsf3(0x3f7ffffd, 0x3f7ffffe, 0x3f7fffff);121 status |= test__divsf3(0x3f7ffffd, 0x3f7fffff, 0x3f7ffffe);122 status |= test__divsf3(0x3f7ffffd, 0x3f800001, 0x3f7ffffb);123 status |= test__divsf3(0x3f7ffffd, 0x3f800002, 0x3f7ffff9);124 status |= test__divsf3(0x3f7ffffe, 0x3f7ffff9, 0x3f800003);125 status |= test__divsf3(0x3f7ffffe, 0x3f7ffffc, 0x3f800001);126 status |= test__divsf3(0x3f7ffffe, 0x3f7ffffd, 0x3f800001);127 status |= test__divsf3(0x3f7ffffe, 0x3f7fffff, 0x3f7fffff);128 status |= test__divsf3(0x3f7ffffe, 0x3f800001, 0x3f7ffffc);129 status |= test__divsf3(0x3f7ffffe, 0x3f800002, 0x3f7ffffa);130 status |= test__divsf3(0x3f7ffffe, 0x3f800003, 0x3f7ffff8);131 status |= test__divsf3(0x3f7fffff, 0x3f7ffff9, 0x3f800003);132 status |= test__divsf3(0x3f7fffff, 0x3f7ffffc, 0x3f800002);133 status |= test__divsf3(0x3f7fffff, 0x3f7ffffd, 0x3f800001);134 status |= test__divsf3(0x3f7fffff, 0x3f7ffffe, 0x3f800001);135 status |= test__divsf3(0x3f7fffff, 0x3f800001, 0x3f7ffffd);136 status |= test__divsf3(0x3f7fffff, 0x3f800002, 0x3f7ffffb);137 status |= test__divsf3(0x3f7fffff, 0x3f800003, 0x3f7ffff9);138 status |= test__divsf3(0x3f7fffff, 0x3f800004, 0x3f7ffff7);139 status |= test__divsf3(0x3f800000, 0x00000000, 0x7f800000);140 status |= test__divsf3(0x3f800000, 0x3f7ffff7, 0x3f800005);141 status |= test__divsf3(0x3f800000, 0x3f7ffff8, 0x3f800004);142 status |= test__divsf3(0x3f800000, 0x3f7ffffb, 0x3f800003);143 status |= test__divsf3(0x3f800000, 0x3f7ffffc, 0x3f800002);144 status |= test__divsf3(0x3f800000, 0x3f7ffffd, 0x3f800002);145 status |= test__divsf3(0x3f800000, 0x3f7ffffe, 0x3f800001);146 status |= test__divsf3(0x3f800000, 0x3f7fffff, 0x3f800001);147 status |= test__divsf3(0x3f800000, 0x3f800000, 0x3f800000);148 status |= test__divsf3(0x3f800000, 0x3f800001, 0x3f7ffffe);149 status |= test__divsf3(0x3f800000, 0x3f800002, 0x3f7ffffc);150 status |= test__divsf3(0x3f800000, 0x3f800003, 0x3f7ffffa);151 status |= test__divsf3(0x3f800000, 0x3f800004, 0x3f7ffff8);152 status |= test__divsf3(0x3f800000, 0x7f800000, 0x00000000);153 status |= test__divsf3(0x3f800001, 0x3f7ffffb, 0x3f800004);154 status |= test__divsf3(0x3f800001, 0x3f7ffffd, 0x3f800003);155 status |= test__divsf3(0x3f800001, 0x3f7ffffe, 0x3f800002);156 status |= test__divsf3(0x3f800001, 0x3f7fffff, 0x3f800002);157 status |= test__divsf3(0x3f800001, 0x3f800002, 0x3f7ffffe);158 status |= test__divsf3(0x3f800001, 0x3f800003, 0x3f7ffffc);159 status |= test__divsf3(0x3f800002, 0x3f7ffffc, 0x3f800004);160 status |= test__divsf3(0x3f800002, 0x3f7ffffd, 0x3f800004);161 status |= test__divsf3(0x3f800002, 0x3f7ffffe, 0x3f800003);162 status |= test__divsf3(0x3f800002, 0x3f7fffff, 0x3f800003);163 status |= test__divsf3(0x3f800002, 0x3f800001, 0x3f800001);164 status |= test__divsf3(0x3f800002, 0x3f800003, 0x3f7ffffe);165 status |= test__divsf3(0x3f800003, 0x3f7ffffd, 0x3f800005);166 status |= test__divsf3(0x3f800003, 0x3f7ffffe, 0x3f800004);167 status |= test__divsf3(0x3f800003, 0x3f7fffff, 0x3f800004);168 status |= test__divsf3(0x3f800003, 0x3f800001, 0x3f800002);169 status |= test__divsf3(0x3f800004, 0x3f7ffffe, 0x3f800005);170 status |= test__divsf3(0x3f800004, 0x3f800001, 0x3f800003);171 status |= test__divsf3(0x3f800004, 0x3f800007, 0x3f7ffffa);172 status |= test__divsf3(0x3f800005, 0x3f7fffff, 0x3f800006);173 status |= test__divsf3(0x3f800006, 0x3f800008, 0x3f7ffffc);174 status |= test__divsf3(0x3f800007, 0x3f800002, 0x3f800005);175 status |= test__divsf3(0x3f800009, 0x3f800008, 0x3f800001);176 status |= test__divsf3(0x40000000, 0x3f800000, 0x40000000);177 status |= test__divsf3(0x40000000, 0xbf800000, 0xc0000000);178 status |= test__divsf3(0x40400000, 0x80000000, 0xff800000);179 status |= test__divsf3(0x40400000, 0xc0400000, 0xbf800000);180 status |= test__divsf3(0x40400000, 0xff800000, 0x80000000);181 status |= test__divsf3(0x40a00000, 0x00000000, 0x7f800000);182 status |= test__divsf3(0x40a00000, 0x40a00000, 0x3f800000);183 status |= test__divsf3(0x40a00000, 0x7f800000, 0x00000000);184 status |= test__divsf3(0x40e00000, 0x80000000, 0xff800000);185 status |= test__divsf3(0x40e00000, 0xff800000, 0x80000000);186 status |= test__divsf3(0x41000000, 0x40000000, 0x40800000);187 status |= test__divsf3(0x41100000, 0x40400000, 0x40400000);188 status |= test__divsf3(0x7b000000, 0x05000000, 0x7f800000);189 status |= test__divsf3(0x7e7fffff, 0x80000000, 0xff800000);190 status |= test__divsf3(0x7efffffd, 0xc0000000, 0xfe7ffffd);191 status |= test__divsf3(0x7effffff, 0x00000000, 0x7f800000);192 status |= test__divsf3(0x7effffff, 0x7f800000, 0x00000000);193 status |= test__divsf3(0x7f000000, 0x00000000, 0x7f800000);194 status |= test__divsf3(0x7f000000, 0x007fffff, 0x7f800000);195 status |= test__divsf3(0x7f000000, 0x3f000000, 0x7f800000);196 status |= test__divsf3(0x7f000000, 0x40000000, 0x7e800000);197 status |= test__divsf3(0x7f000000, 0x7f800000, 0x00000000);198 status |= test__divsf3(0x7f000000, 0x80000000, 0xff800000);199 status |= test__divsf3(0x7f000000, 0xbf000000, 0xff800000);200 status |= test__divsf3(0x7f000000, 0xc0000000, 0xfe800000);201 status |= test__divsf3(0x7f000000, 0xff800000, 0x80000000);202 status |= test__divsf3(0x7f000003, 0xfe800003, 0xc0000000);203 status |= test__divsf3(0x7f7ffffd, 0x40800000, 0x7e7ffffd);204 status |= test__divsf3(0x7f7ffffd, 0xc0800000, 0xfe7ffffd);205 status |= test__divsf3(0x7f7fffff, 0x00000001, 0x7f800000);206 status |= test__divsf3(0x7f7fffff, 0x3f7fffff, 0x7f800000);207 status |= test__divsf3(0x7f7fffff, 0x7e7fffff, 0x40800000);208 status |= test__divsf3(0x7f7fffff, 0x7effffff, 0x40000000);209 status |= test__divsf3(0x7f7fffff, 0xc0000000, 0xfeffffff);210 status |= test__divsf3(0x7f7fffff, 0xfe7fffff, 0xc0800000);211 status |= test__divsf3(0x7f7fffff, 0xff800000, 0x80000000);212 status |= test__divsf3(0x7f800000, 0x00000000, 0x7f800000);213 status |= test__divsf3(0x7f800000, 0x00000001, 0x7f800000);214 status |= test__divsf3(0x7f800000, 0x007fffff, 0x7f800000);215 status |= test__divsf3(0x7f800000, 0x00800000, 0x7f800000);216 status |= test__divsf3(0x7f800000, 0x00ffffff, 0x7f800000);217 status |= test__divsf3(0x7f800000, 0x3f800000, 0x7f800000);218 status |= test__divsf3(0x7f800000, 0x40a00000, 0x7f800000);219 status |= test__divsf3(0x7f800000, 0x7effffff, 0x7f800000);220 status |= test__divsf3(0x7f800000, 0x7f000000, 0x7f800000);221 status |= test__divsf3(0x7f800000, 0x80000000, 0xff800000);222 status |= test__divsf3(0x7f800000, 0x80000002, 0xff800000);223 status |= test__divsf3(0x7f800000, 0x807fffff, 0xff800000);224 status |= test__divsf3(0x7f800000, 0x80800001, 0xff800000);225 status |= test__divsf3(0x7f800000, 0x81000000, 0xff800000);226 status |= test__divsf3(0x7f800000, 0xc0400000, 0xff800000);227 status |= test__divsf3(0x7f800000, 0xc0e00000, 0xff800000);228 status |= test__divsf3(0x7f800000, 0xfe7fffff, 0xff800000);229 status |= test__divsf3(0x7f800000, 0xff000000, 0xff800000);230 status |= test__divsf3(0x7f800000, 0xff7fffff, 0xff800000);231 status |= test__divsf3(0x80000000, 0x00000003, 0x80000000);232 status |= test__divsf3(0x80000000, 0x007fffff, 0x80000000);233 status |= test__divsf3(0x80000000, 0x00800001, 0x80000000);234 status |= test__divsf3(0x80000000, 0x01000000, 0x80000000);235 status |= test__divsf3(0x80000000, 0x40000000, 0x80000000);236 status |= test__divsf3(0x80000000, 0x40c00000, 0x80000000);237 status |= test__divsf3(0x80000000, 0x7e7fffff, 0x80000000);238 status |= test__divsf3(0x80000000, 0x7e800000, 0x80000000);239 status |= test__divsf3(0x80000000, 0x7f800000, 0x80000000);240 status |= test__divsf3(0x80000000, 0x80000004, 0x00000000);241 status |= test__divsf3(0x80000000, 0x807fffff, 0x00000000);242 status |= test__divsf3(0x80000000, 0x80800000, 0x00000000);243 status |= test__divsf3(0x80000000, 0x80ffffff, 0x00000000);244 status |= test__divsf3(0x80000000, 0xc0800000, 0x00000000);245 status |= test__divsf3(0x80000000, 0xc1000000, 0x00000000);246 status |= test__divsf3(0x80000000, 0xfe800000, 0x00000000);247 status |= test__divsf3(0x80000000, 0xfeffffff, 0x00000000);248 status |= test__divsf3(0x80000000, 0xff800000, 0x00000000);249 status |= test__divsf3(0x80000001, 0x3f000000, 0x80000002);250 status |= test__divsf3(0x80000001, 0x40000000, 0x80000000);251 status |= test__divsf3(0x80000001, 0x7f7fffff, 0x80000000);252 status |= test__divsf3(0x80000001, 0xc0000000, 0x00000000);253 status |= test__divsf3(0x80000001, 0xff7fffff, 0x00000000);254 status |= test__divsf3(0x80000003, 0x00000000, 0xff800000);255 status |= test__divsf3(0x80000003, 0x7f800000, 0x80000000);256 status |= test__divsf3(0x80000004, 0x80000000, 0x7f800000);257 status |= test__divsf3(0x80000004, 0xff800000, 0x00000000);258 status |= test__divsf3(0x807ffff8, 0x3f7ffffe, 0x807ffff9);259 status |= test__divsf3(0x807fffff, 0x00000000, 0xff800000);260 status |= test__divsf3(0x807fffff, 0x7f800000, 0x80000000);261 status |= test__divsf3(0x807fffff, 0x80000000, 0x7f800000);262 status |= test__divsf3(0x807fffff, 0xff800000, 0x00000000);263 status |= test__divsf3(0x80800000, 0x3f800001, 0x807fffff);264 status |= test__divsf3(0x80800000, 0x80000000, 0x7f800000);265 status |= test__divsf3(0x80800000, 0xff800000, 0x00000000);266 status |= test__divsf3(0x80800001, 0x00000000, 0xff800000);267 status |= test__divsf3(0x80800001, 0x7f800000, 0x80000000);268 status |= test__divsf3(0x80ffffff, 0x80000000, 0x7f800000);269 status |= test__divsf3(0x80ffffff, 0xff800000, 0x00000000);270 status |= test__divsf3(0x81000000, 0x00000000, 0xff800000);271 status |= test__divsf3(0x81000000, 0x7f800000, 0x80000000);272 status |= test__divsf3(0x81000001, 0x00800001, 0xc0000000);273 status |= test__divsf3(0x81000005, 0x00800005, 0xc0000000);274 status |= test__divsf3(0xbf800000, 0x3f800000, 0xbf800000);275 status |= test__divsf3(0xbf800000, 0xbf800000, 0x3f800000);276 status |= test__divsf3(0xc0000000, 0x00000000, 0xff800000);277 status |= test__divsf3(0xc0000000, 0x3f800000, 0xc0000000);278 status |= test__divsf3(0xc0000000, 0x7f800000, 0x80000000);279 status |= test__divsf3(0xc0000000, 0xbf800000, 0x40000000);280 status |= test__divsf3(0xc0800000, 0x80000000, 0x7f800000);281 status |= test__divsf3(0xc0800000, 0xff800000, 0x00000000);282 status |= test__divsf3(0xc0c00000, 0x00000000, 0xff800000);283 status |= test__divsf3(0xc0c00000, 0x7f800000, 0x80000000);284 status |= test__divsf3(0xc0c00000, 0xc0400000, 0x40000000);285 status |= test__divsf3(0xc0e00000, 0x40e00000, 0xbf800000);286 status |= test__divsf3(0xc1000000, 0x40000000, 0xc0800000);287 status |= test__divsf3(0xc1000000, 0x80000000, 0x7f800000);288 status |= test__divsf3(0xc1000000, 0xff800000, 0x00000000);289 status |= test__divsf3(0xc1100000, 0xc0400000, 0x40400000);290 status |= test__divsf3(0xfe7fffff, 0x00000000, 0xff800000);291 status |= test__divsf3(0xfe7fffff, 0x7f800000, 0x80000000);292 status |= test__divsf3(0xfe800000, 0x00000000, 0xff800000);293 status |= test__divsf3(0xfe800000, 0x7f800000, 0x80000000);294 status |= test__divsf3(0xfe800000, 0x80000000, 0x7f800000);295 status |= test__divsf3(0xfe800000, 0xff800000, 0x00000000);296 status |= test__divsf3(0xfeffffff, 0x40000000, 0xfe7fffff);297 status |= test__divsf3(0xfeffffff, 0x80000000, 0x7f800000);298 status |= test__divsf3(0xff000000, 0x3f000000, 0xff800000);299 status |= test__divsf3(0xff000000, 0xbf000000, 0x7f800000);300 status |= test__divsf3(0xff000001, 0x7e800001, 0xc0000000);301 status |= test__divsf3(0xff7ffffd, 0x40800000, 0xfe7ffffd);302 status |= test__divsf3(0xff7ffffd, 0xc0800000, 0x7e7ffffd);303 status |= test__divsf3(0xff7fffff, 0x7e7fffff, 0xc0800000);304 status |= test__divsf3(0xff7fffff, 0xfe7fffff, 0x40800000);305 status |= test__divsf3(0xff7fffff, 0xff800000, 0x00000000);306 status |= test__divsf3(0xff800000, 0x00000000, 0xff800000);307 status |= test__divsf3(0xff800000, 0x00000003, 0xff800000);308 status |= test__divsf3(0xff800000, 0x007fffff, 0xff800000);309 status |= test__divsf3(0xff800000, 0x00800001, 0xff800000);310 status |= test__divsf3(0xff800000, 0x01000000, 0xff800000);311 status |= test__divsf3(0xff800000, 0x40000000, 0xff800000);312 status |= test__divsf3(0xff800000, 0x40c00000, 0xff800000);313 status |= test__divsf3(0xff800000, 0x7e800000, 0xff800000);314 status |= test__divsf3(0xff800000, 0x80000000, 0x7f800000);315 status |= test__divsf3(0xff800000, 0x80000004, 0x7f800000);316 status |= test__divsf3(0xff800000, 0x807fffff, 0x7f800000);317 status |= test__divsf3(0xff800000, 0x80800000, 0x7f800000);318 status |= test__divsf3(0xff800000, 0x80ffffff, 0x7f800000);319 status |= test__divsf3(0xff800000, 0xc0800000, 0x7f800000);320 status |= test__divsf3(0xff800000, 0xc1000000, 0x7f800000);321 status |= test__divsf3(0xff800000, 0xfe800000, 0x7f800000);322 status |= test__divsf3(0xff800000, 0xff7fffff, 0x7f800000);323 status |= test__divsf3(0x2cbed883, 0x333f6113, 0x38ff4953);324 status |= test__divsf3(0x3f87ffff, 0x7f001000, 0x0043f781);325 326 // Test that the result of an operation is a NaN at all when it should be.327 //328 // In most configurations these tests' results are checked compared using329 // compareResultF, so we set all the answers to the canonical NaN 0x7fc00000,330 // which causes compareResultF to accept any NaN encoding. We also use the331 // same value as the input NaN in tests that have one, so that even in332 // EXPECT_EXACT_RESULTS mode these tests should pass, because 0x7fc00000 is333 // still the exact expected NaN.334 status |= test__divsf3(0x00000000, 0x00000000, 0x7fc00000);335 status |= test__divsf3(0x00000000, 0x80000000, 0x7fc00000);336 status |= test__divsf3(0x7f800000, 0x7f800000, 0x7fc00000);337 status |= test__divsf3(0x7f800000, 0xff800000, 0x7fc00000);338 status |= test__divsf3(0x80000000, 0x00000000, 0x7fc00000);339 status |= test__divsf3(0x80000000, 0x80000000, 0x7fc00000);340 status |= test__divsf3(0xff800000, 0x7f800000, 0x7fc00000);341 status |= test__divsf3(0xff800000, 0xff800000, 0x7fc00000);342 status |= test__divsf3(0x3f800000, 0x7fc00000, 0x7fc00000);343 status |= test__divsf3(0x7fc00000, 0x3f800000, 0x7fc00000);344 status |= test__divsf3(0x7fc00000, 0x7fc00000, 0x7fc00000);345 346#ifdef ARM_NAN_HANDLING347 // Tests specific to the NaN handling of Arm hardware, mimicked by348 // arm/divsf3.S:349 //350 // - a quiet NaN is distinguished by the top mantissa bit being 1351 //352 // - if a signalling NaN appears in the input, the output quiet NaN is353 // obtained by setting its top mantissa bit and leaving everything else354 // unchanged355 //356 // - if both operands are signalling NaNs then the output NaN is derived357 // from the first operand358 //359 // - if both operands are quiet NaNs then the output NaN is the first360 // operand361 //362 // - invalid operations not involving an input NaN return the quiet363 // NaN with fewest bits set, 0x7fc00000.364 365 status |= test__divsf3(0x00000000, 0x00000000, 0x7fc00000);366 status |= test__divsf3(0x00000000, 0x7fad4be3, 0x7fed4be3);367 status |= test__divsf3(0x00000000, 0x7fdf48c7, 0x7fdf48c7);368 status |= test__divsf3(0x00000000, 0x80000000, 0x7fc00000);369 status |= test__divsf3(0x00000001, 0x7f970eba, 0x7fd70eba);370 status |= test__divsf3(0x00000001, 0x7fc35716, 0x7fc35716);371 status |= test__divsf3(0x007fffff, 0x7fbf52d6, 0x7fff52d6);372 status |= test__divsf3(0x007fffff, 0x7fc7a2df, 0x7fc7a2df);373 status |= test__divsf3(0x3f800000, 0x7f987a85, 0x7fd87a85);374 status |= test__divsf3(0x3f800000, 0x7fc50124, 0x7fc50124);375 status |= test__divsf3(0x7f7fffff, 0x7f95fd6f, 0x7fd5fd6f);376 status |= test__divsf3(0x7f7fffff, 0x7ffc28dc, 0x7ffc28dc);377 status |= test__divsf3(0x7f800000, 0x7f800000, 0x7fc00000);378 status |= test__divsf3(0x7f800000, 0x7f8dd790, 0x7fcdd790);379 status |= test__divsf3(0x7f800000, 0x7fd2ef2b, 0x7fd2ef2b);380 status |= test__divsf3(0x7f800000, 0xff800000, 0x7fc00000);381 status |= test__divsf3(0x7f99b09d, 0x00000000, 0x7fd9b09d);382 status |= test__divsf3(0x7f93541e, 0x00000001, 0x7fd3541e);383 status |= test__divsf3(0x7f9fc002, 0x007fffff, 0x7fdfc002);384 status |= test__divsf3(0x7fb5db77, 0x3f800000, 0x7ff5db77);385 status |= test__divsf3(0x7f9f5d92, 0x7f7fffff, 0x7fdf5d92);386 status |= test__divsf3(0x7fac7a36, 0x7f800000, 0x7fec7a36);387 status |= test__divsf3(0x7fb42008, 0x7fb0ee07, 0x7ff42008);388 status |= test__divsf3(0x7f8bd740, 0x7fc7aaf1, 0x7fcbd740);389 status |= test__divsf3(0x7f9bb57b, 0x80000000, 0x7fdbb57b);390 status |= test__divsf3(0x7f951a78, 0x80000001, 0x7fd51a78);391 status |= test__divsf3(0x7f9ba63b, 0x807fffff, 0x7fdba63b);392 status |= test__divsf3(0x7f89463c, 0xbf800000, 0x7fc9463c);393 status |= test__divsf3(0x7fb63563, 0xff7fffff, 0x7ff63563);394 status |= test__divsf3(0x7f90886e, 0xff800000, 0x7fd0886e);395 status |= test__divsf3(0x7fe8c15e, 0x00000000, 0x7fe8c15e);396 status |= test__divsf3(0x7fe915ae, 0x00000001, 0x7fe915ae);397 status |= test__divsf3(0x7ffa9b42, 0x007fffff, 0x7ffa9b42);398 status |= test__divsf3(0x7fdad0f5, 0x3f800000, 0x7fdad0f5);399 status |= test__divsf3(0x7fd10dcb, 0x7f7fffff, 0x7fd10dcb);400 status |= test__divsf3(0x7fd08e8a, 0x7f800000, 0x7fd08e8a);401 status |= test__divsf3(0x7fc3a9e6, 0x7f91a816, 0x7fd1a816);402 status |= test__divsf3(0x7fdb229c, 0x7fc26c68, 0x7fdb229c);403 status |= test__divsf3(0x7fc9f6bb, 0x80000000, 0x7fc9f6bb);404 status |= test__divsf3(0x7ffa178b, 0x80000001, 0x7ffa178b);405 status |= test__divsf3(0x7fef2a0b, 0x807fffff, 0x7fef2a0b);406 status |= test__divsf3(0x7ffc885b, 0xbf800000, 0x7ffc885b);407 status |= test__divsf3(0x7fd26e8c, 0xff7fffff, 0x7fd26e8c);408 status |= test__divsf3(0x7fc55329, 0xff800000, 0x7fc55329);409 status |= test__divsf3(0x80000000, 0x00000000, 0x7fc00000);410 status |= test__divsf3(0x80000000, 0x7fa833ae, 0x7fe833ae);411 status |= test__divsf3(0x80000000, 0x7fc4df63, 0x7fc4df63);412 status |= test__divsf3(0x80000000, 0x80000000, 0x7fc00000);413 status |= test__divsf3(0x80000001, 0x7f98827d, 0x7fd8827d);414 status |= test__divsf3(0x80000001, 0x7fd7acc5, 0x7fd7acc5);415 status |= test__divsf3(0x807fffff, 0x7fad19c0, 0x7fed19c0);416 status |= test__divsf3(0x807fffff, 0x7ffe1907, 0x7ffe1907);417 status |= test__divsf3(0xbf800000, 0x7fa95487, 0x7fe95487);418 status |= test__divsf3(0xbf800000, 0x7fd2bbee, 0x7fd2bbee);419 status |= test__divsf3(0xff7fffff, 0x7f86ba21, 0x7fc6ba21);420 status |= test__divsf3(0xff7fffff, 0x7feb00d7, 0x7feb00d7);421 status |= test__divsf3(0xff800000, 0x7f800000, 0x7fc00000);422 status |= test__divsf3(0xff800000, 0x7f857fdc, 0x7fc57fdc);423 status |= test__divsf3(0xff800000, 0x7fde0397, 0x7fde0397);424 status |= test__divsf3(0xff800000, 0xff800000, 0x7fc00000);425#endif // ARM_NAN_HANDLING426 427 return status;428}429