1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14definitions: [] 15tests: 16 - file-name: 'fneg' 17 isa: 18 title: Floating-point unary 19 description: > 20 Perform specified floating-point operation on accumulator 21 exceptions: 22 - x_none 23 24 commands: 25 - file-name: 'op_none' 26 isa: 27 instructions: 28 - sig: fneg 29 acc: inout:f32 30 prefix: f32 31 format: [pref_op_none] 32 code-template: | 33 # 34 fldai %s 35 fneg 36 fmovi v0, %s 37 fcmpg v0 38 description: Check fneg with various values. 39 tags: ['tsan', 'irtoc_ignore'] 40 cases: 41 - values: 42 - '0.0' 43 - '0.0' 44 - values: 45 - '-1.0' 46 - '1.0' 47 - values: 48 - '1.0' 49 - '-1.0' 50 - values: 51 - '3.1415926' 52 - '-3.1415926' 53 - values: 54 - '-4.9e-30' 55 - '+4.9e-30' 56 - values: 57 - '1.7976931e30' 58 - '-1.7976931e30' 59 - values: 60 - '+4.9e-30' 61 - '-4.9e-30' 62 - values: 63 - '-1.7976931e38' 64 - '+1.7976931e38' 65 66 - file-name: 'nan' 67 isa: 68 instructions: 69 - sig: fneg 70 acc: inout:f32 71 prefix: f32 72 format: [pref_op_none] 73 tags: ['irtoc_ignore'] 74 check-type: check-acc-nan-f32 75 code-template: | 76 # 77 fldai %s 78 fneg 79 description: Check fneg with NaN. 80 cases: 81 - values: 82 # NaN 83 - '0x7fc00000' 84 - values: 85 # NaN 86 - '0xFFFFFFFF' 87 88 - file-name: 'bin_val' 89 isa: 90 instructions: 91 - sig: fneg 92 acc: inout:f32 93 prefix: f32 94 format: [pref_op_none] 95 tags: ['irtoc_ignore'] 96 code-template: | 97 # 98 fldai %s 99 fneg 100 fmovi v0, %s 101 fcmpg v0 102 description: Check fneg with various values (HEX literals). 103 cases: 104 - values: 105 # -max 106 - '0xff7fffff' 107 # +max 108 - '0x7f7fffff' 109 - values: 110 # +max 111 - '0x7f7fffff' 112 # -max 113 - '0xff7fffff' 114 - values: 115 # -Inf 116 - '0xff800000' 117 # +Inf 118 - '0x7f800000' 119 - values: 120 # +Inf 121 - '0x7f800000' 122 # -Inf 123 - '0xff800000' 124 - values: 125 # +min 126 - '0x00000001' 127 # -min 128 - '0x80000001' 129 - values: 130 # -min 131 - '0x80000001' 132 # +min 133 - '0x00000001' 134 - values: 135 # -0.0d 136 - '0x80000000' 137 - '0' 138 - values: 139 - '0' 140 # -0.0d 141 - '0x80000000' 142 143 - file-name: 'acc_type' 144 isa: 145 verification: 146 - acc_type 147 runner-options: ['verifier-failure', 'verifier-config'] 148 bugid: ['964'] 149 tags: ['verifier'] 150 header-template: [] 151 code-template: | 152 .record T {} 153 .record panda.String <external> 154 .record panda.Object <external> 155 # 156 .function i32 main() { 157 %s 158 fneg 159 check-type: exit-positive 160 description: Check `fneg` with incorrect accumulator type. 161 cases: 162 - values: 163 - ldai 1 164 - values: 165 - ldai.64 1 166 - values: 167 - fldai.64 0 168 - values: 169 - lda.type T 170 - values: 171 - lda.type T[] 172 - values: 173 - lda.type panda.Object 174 - values: 175 - lda.type panda.String 176 - values: 177 - lda.str "x" 178 - values: 179 - | 180 # 181 newobj v0, T 182 lda.obj v0 183 - values: 184 - lda.null 185 - values: 186 - | 187 # 188 movi v0, 10 189 newarr v0, v0, i32[] 190 lda.obj v0 191 192 - file-name: uninitialized_regs 193 bugid: ['2787'] 194 tags: ['verifier'] 195 isa: 196 instructions: 197 - sig: fneg 198 acc: inout:f32 199 prefix: f32 200 format: [pref_op_none] 201 description: Check fneg with uninitialized accumulator. 202 runner-options: ['verifier-failure', 'verifier-config'] 203 header-template: [] 204 code-template: | 205 # 206 .function i32 main() { 207 # acc is undefined 208 fneg 209 check-type: exit-positive 210