Jens Wiklander | 246184a | 2015-12-11 08:28:59 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2015, Linaro Limited |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright notice, |
| 9 | * this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | * this list of conditions and the following disclaimer in the documentation |
| 13 | * and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 | * POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #include "test_float_subj.h" |
| 29 | |
| 30 | double test_float_dadd(double a, double b) |
| 31 | { |
| 32 | return a + b; |
| 33 | } |
| 34 | |
| 35 | double test_float_ddiv(double n, double d) |
| 36 | { |
| 37 | return n / d; |
| 38 | } |
| 39 | |
| 40 | double test_float_dmul(double a, double b) |
| 41 | { |
| 42 | return a * b; |
| 43 | } |
| 44 | |
| 45 | double test_float_drsub(double a, double b) |
| 46 | { |
| 47 | return b - a; |
| 48 | } |
| 49 | |
| 50 | double test_float_dsub(double a, double b) |
| 51 | { |
| 52 | return a - b; |
| 53 | } |
| 54 | |
| 55 | int test_float_dcmpeq(double a, double b) |
| 56 | { |
| 57 | return a == b; |
| 58 | } |
| 59 | |
| 60 | int test_float_dcmplt(double a, double b) |
| 61 | { |
| 62 | return a < b; |
| 63 | } |
| 64 | |
| 65 | int test_float_dcmple(double a, double b) |
| 66 | { |
| 67 | return a <= b; |
| 68 | } |
| 69 | |
| 70 | int test_float_dcmpge(double a, double b) |
| 71 | { |
| 72 | return a >= b; |
| 73 | } |
| 74 | |
| 75 | int test_float_dcmpgt(double a, double b) |
| 76 | { |
| 77 | return a > b; |
| 78 | } |
| 79 | |
| 80 | float test_float_fadd(float a, float b) |
| 81 | { |
| 82 | return a + b; |
| 83 | } |
| 84 | |
| 85 | float test_float_fdiv(float n, float d) |
| 86 | { |
| 87 | return n / d; |
| 88 | } |
| 89 | |
| 90 | float test_float_fmul(float a, float b) |
| 91 | { |
| 92 | return a * b; |
| 93 | } |
| 94 | |
| 95 | float test_float_frsub(float a, float b) |
| 96 | { |
| 97 | return b - a; |
| 98 | } |
| 99 | |
| 100 | float test_float_fsub(float a, float b) |
| 101 | { |
| 102 | return a - b; |
| 103 | } |
| 104 | |
| 105 | int test_float_fcmpeq(float a, float b) |
| 106 | { |
| 107 | return a == b; |
| 108 | } |
| 109 | |
| 110 | int test_float_fcmplt(float a, float b) |
| 111 | { |
| 112 | return a < b; |
| 113 | } |
| 114 | |
| 115 | int test_float_fcmple(float a, float b) |
| 116 | { |
| 117 | return a <= b; |
| 118 | } |
| 119 | |
| 120 | int test_float_fcmpge(float a, float b) |
| 121 | { |
| 122 | return a >= b; |
| 123 | } |
| 124 | |
| 125 | int test_float_fcmpgt(float a, float b) |
| 126 | { |
| 127 | return a > b; |
| 128 | } |
| 129 | |
| 130 | int test_float_d2iz(double a) |
| 131 | { |
| 132 | return a; |
| 133 | } |
| 134 | |
| 135 | unsigned test_float_d2uiz(double a) |
| 136 | { |
| 137 | return a; |
| 138 | } |
| 139 | |
| 140 | long long test_float_d2lz(double a) |
| 141 | { |
| 142 | return a; |
| 143 | } |
| 144 | |
| 145 | unsigned long long test_float_d2ulz(double a) |
| 146 | { |
| 147 | return a; |
| 148 | } |
| 149 | |
| 150 | int test_float_f2iz(float a) |
| 151 | { |
| 152 | return a; |
| 153 | } |
| 154 | |
| 155 | unsigned test_float_f2uiz(float a) |
| 156 | { |
| 157 | return a; |
| 158 | } |
| 159 | |
| 160 | long long test_float_f2lz(float a) |
| 161 | { |
| 162 | return a; |
| 163 | } |
| 164 | |
| 165 | unsigned long long test_float_f2ulz(float a) |
| 166 | { |
| 167 | return a; |
| 168 | } |
| 169 | |
| 170 | float test_float_d2f(double a) |
| 171 | { |
| 172 | return a; |
| 173 | } |
| 174 | |
| 175 | double test_float_f2d(float a) |
| 176 | { |
| 177 | return a; |
| 178 | } |
| 179 | |
| 180 | double test_float_i2d(int a) |
| 181 | { |
| 182 | return a; |
| 183 | } |
| 184 | |
| 185 | double test_float_ui2d(unsigned a) |
| 186 | { |
| 187 | return a; |
| 188 | } |
| 189 | |
| 190 | double test_float_l2d(long long a) |
| 191 | { |
| 192 | return a; |
| 193 | } |
| 194 | |
| 195 | double test_float_ul2d(unsigned long long a) |
| 196 | { |
| 197 | return a; |
| 198 | } |
| 199 | |
| 200 | float test_float_i2f(int a) |
| 201 | { |
| 202 | return a; |
| 203 | } |
| 204 | |
| 205 | float test_float_ui2f(unsigned a) |
| 206 | { |
| 207 | return a; |
| 208 | } |
| 209 | |
| 210 | float test_float_l2f(long long a) |
| 211 | { |
| 212 | return a; |
| 213 | } |
| 214 | |
| 215 | float test_float_ul2f(unsigned long long a) |
| 216 | { |
| 217 | return a; |
| 218 | } |