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: "u64tof32" 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: u64tof32 28 acc: inout:u64->f32 29 prefix: cast 30 format: [pref_op_none] 31 code-template: | 32 # 33 ldai.64 %s 34 u64tof32 35 fmovi v0, %s 36 fcmpg v0 37 description: Check u64tof32 with various values. 38 tags: ['tsan', 'irtoc_ignore'] 39 cases: 40 - values: 41 - "0" 42 - "0.0" 43 - values: 44 - "-1" 45 - "1.8446744073709552e19" 46 - values: 47 - "1" 48 - "1.0" 49 - values: 50 - "0x7fffffff" 51 - "2.14748365e9" 52 - values: 53 - "-0x7fffffff" 54 - "1.8446744071562068e19" 55 - values: 56 - "-2147483648" 57 - "1.8446744071562068e19" 58 - values: 59 - "0x7fffffffffffffff" 60 - "9223372036854775807.0" 61 - values: 62 - "-0x7fffffffffffffff" 63 - "9223372036854775807.0" 64 - values: 65 - "0x8000000000000000" 66 - "9223372036854775807.0" 67 - values: 68 - "-0x8000000000000000" 69 - "9223372036854775807.0" 70 - values: 71 - "0xffffffffffffffff" 72 - "1.8446744073709552e19" 73 - values: 74 - "-0xffffffffffffffff" 75 - "1" 76 - values: 77 - "0x7fffffffffffffff" 78 - "9223372036854776000.0" 79 - values: 80 - "-9223372036854775808" 81 - "9.223372036854776e18" 82 - values: 83 - "-9223372036854775700" 84 - "9.223372036854776e18" 85 - values: 86 - "-9223372036854775808" 87 - "9.223372036854776e18" 88 - values: 89 - "-9223372036854775800" 90 - "9.223372036854776e18" 91 92 - file-name: "type" 93 isa: 94 instructions: 95 - sig: u64tof32 96 acc: inout:u64->f32 97 prefix: cast 98 format: [pref_op_none] 99 verification: 100 - acc_type 101 bugid: ["964", "1653"] 102 tags: ["verifier"] 103 description: | 104 Check `u64tof32` with incorrect accumulator type. 105 Load different values (objects, strings, types, 64-bit floating point values, 32-bit integer values) and invokes `u64tof32`. 106 Return 0 to indicate that negative test failed, because this line is unreachable and code will not be executed after verification error. 107 runner-options: ['verifier-failure', 'verifier-config'] 108 header-template: [] 109 code-template: | 110 # 111 .record B {} 112 .record panda.String <external> 113 .record panda.Object <external> 114 .function i32 main() { 115 %s 116 u64tof32 117 check-type: exit-positive 118 cases: 119 - values: 120 - ldai 0 121 - values: 122 - fldai 0 123 - values: 124 - fldai.64 0 125 - values: 126 - lda.type B 127 - values: 128 - lda.type B[] 129 - values: 130 - lda.type panda.String 131 - values: 132 - lda.str "string" 133 - values: 134 - lda.type panda.Object 135 - values: 136 - | 137 # 138 movi v0, 10 139 newarr v0, v0, i32[] 140 lda.obj v0 141 - values: 142 - lda.null 143 144 - file-name: uninitialized_regs 145 isa: 146 instructions: 147 - sig: u64tof32 148 acc: inout:u64->f32 149 prefix: cast 150 format: [pref_op_none] 151 description: Check 'u64tof32' with uninitialized accumulator. 152 tags: ['verifier'] 153 runner-options: ['verifier-failure', 'verifier-config'] 154 code-template: | 155 # 156 u64tof32 157 check-type: exit-positive 158