# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. definitions: [] tests: - file-name: "f64tof32" isa: title: Conversions between integer and floating point types description: > Perform specified primitive type conversion of accumulator. exceptions: - x_none commands: - file-name: "op_none" isa: instructions: - sig: f64tof32 acc: inout:f64->f32 prefix: f32 format: [pref_op_none] code-template: | # fldai.64 %s f64tof32 fmovi v0, %s fcmpg v0 jnez set_failure ldai 0 return set_failure: ldai 1 return check-type: no-check description: Check f64tof32 with various values. tags: ['tsan', 'irtoc_ignore'] cases: - values: - "0.0" - "0.0" - values: - "-0.0" - "-0.0" - values: - "1.0" - "1.0" - values: - "-1.0" - "-1.0" - values: # +inf - "0x7ff0000000000000" - "0x7f800000" - values: # -inf - "0xfff0000000000000" - "0xff800000" - values: # +max -> +inf - "0x7fefffffffffffff" - "0x7f800000" - values: # +min -> 0.0 - "0x0000000000000001" - "0x00000000" - values: # -max -> -inf - "0xffefffffffffffff" - "0xff800000" - values: # -min -> -0.0 - "0x8000000000000001" - "0x80000000" - values: - "3.14159265358979323846" - "3.1415927" - values: - "-3.14159265358979323846" - "-3.1415927" - file-name: "type" isa: instructions: - sig: f64tof32 acc: inout:f64->f32 prefix: f32 format: [pref_op_none] verification: - acc_type bugid: ["964", "1653", "2107"] tags: ["verifier"] description: | Check `f64tof32` with incorrect accumulator type. Load different values (objects, strings, types, 64-bit floating point values, 32-bit integer values) and invokes `f64tof32`. Return 0 to indicate that negative test failed, because this line is unreachable and code will not be executed after verification error. runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .record B {} .record panda.String .record panda.Object .function i32 main() { %s f64tof32 check-type: exit-positive cases: - values: - ldai 0 - values: - ldai.64 0 - values: - fldai 0 bugid: ['6094'] - values: - lda.type B - values: - lda.type B[] - values: - lda.type panda.String - values: - lda.str "string" - values: - lda.type panda.Object - values: - | # movi v0, 10 newarr v0, v0, i32[] lda.obj v0 - values: - lda.null - file-name: uninitialized_regs isa: instructions: - sig: f64tof32 acc: inout:f64->f32 prefix: f32 format: [pref_op_none] description: Check 'f64tof32' with uninitialized accumulator. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] code-template: | # f64tof32 check-type: exit-positive