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: "f64tof32" 17 isa: 18 title: Conversions between integer and floating point types 19 description: > 20 Perform specified primitive type conversion of accumulator. 21 exceptions: 22 - x_none 23 commands: 24 - file-name: "op_none" 25 isa: 26 instructions: 27 - sig: f64tof32 28 acc: inout:f64->f32 29 prefix: f32 30 format: [pref_op_none] 31 code-template: | 32 # 33 fldai.64 %s 34 f64tof32 35 fmovi v0, %s 36 fcmpg v0 37 jnez set_failure 38 ldai 0 39 return 40 set_failure: 41 ldai 1 42 return 43 check-type: no-check 44 description: Check f64tof32 with various values. 45 tags: ['tsan', 'irtoc_ignore'] 46 cases: 47 - values: 48 - "0.0" 49 - "0.0" 50 - values: 51 - "-0.0" 52 - "-0.0" 53 - values: 54 - "1.0" 55 - "1.0" 56 - values: 57 - "-1.0" 58 - "-1.0" 59 - values: 60 # +inf 61 - "0x7ff0000000000000" 62 - "0x7f800000" 63 - values: 64 # -inf 65 - "0xfff0000000000000" 66 - "0xff800000" 67 - values: 68 # +max -> +inf 69 - "0x7fefffffffffffff" 70 - "0x7f800000" 71 - values: 72 # +min -> 0.0 73 - "0x0000000000000001" 74 - "0x00000000" 75 - values: 76 # -max -> -inf 77 - "0xffefffffffffffff" 78 - "0xff800000" 79 - values: 80 # -min -> -0.0 81 - "0x8000000000000001" 82 - "0x80000000" 83 - values: 84 - "3.14159265358979323846" 85 - "3.1415927" 86 - values: 87 - "-3.14159265358979323846" 88 - "-3.1415927" 89 - file-name: "type" 90 isa: 91 instructions: 92 - sig: f64tof32 93 acc: inout:f64->f32 94 prefix: f32 95 format: [pref_op_none] 96 verification: 97 - acc_type 98 bugid: ["964", "1653", "2107"] 99 tags: ["verifier"] 100 description: | 101 Check `f64tof32` with incorrect accumulator type. 102 Load different values (objects, strings, types, 64-bit floating point values, 32-bit integer values) and invokes `f64tof32`. 103 Return 0 to indicate that negative test failed, because this line is unreachable and code will not be executed after verification error. 104 runner-options: ['verifier-failure', 'verifier-config'] 105 header-template: [] 106 code-template: | 107 # 108 .record B {} 109 .record panda.String <external> 110 .record panda.Object <external> 111 .function i32 main() { 112 %s 113 f64tof32 114 check-type: exit-positive 115 cases: 116 - values: 117 - ldai 0 118 - values: 119 - ldai.64 0 120 - values: 121 - fldai 0 122 bugid: ['6094'] 123 - values: 124 - lda.type B 125 - values: 126 - lda.type B[] 127 - values: 128 - lda.type panda.String 129 - values: 130 - lda.str "string" 131 - values: 132 - lda.type panda.Object 133 - values: 134 - | 135 # 136 movi v0, 10 137 newarr v0, v0, i32[] 138 lda.obj v0 139 - values: 140 - lda.null 141 142 - file-name: uninitialized_regs 143 isa: 144 instructions: 145 - sig: f64tof32 146 acc: inout:f64->f32 147 prefix: f32 148 format: [pref_op_none] 149 description: Check 'f64tof32' with uninitialized accumulator. 150 tags: ['verifier'] 151 runner-options: ['verifier-failure', 'verifier-config'] 152 code-template: | 153 # 154 f64tof32 155 check-type: exit-positive 156