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