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