# 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: fcmpg isa: title: Floating-point comparison description: Perform specified floating point comparison between register and accumulator. exceptions: - x_none commands: - file-name: zero isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] description: Check fcmpg compares zero with other zero values. tags: ['irtoc_ignore'] code-template: | # fldai %s fmovi v0, %s fcmpg v0 check-type: check-positive cases: - values: - '0.0' - '0.0' - values: - '-0.0' - '-0.0' - values: - '-0.0' - '0.0' - values: - '0.0' - '-0.0' - file-name: nan isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] description: Check fcmpg compares NaN values. tags: ['irtoc_ignore'] code-template: | # test - check binary representation and comparison of FP literals - NaN fldai 0x7fc00000 fmovi v0, %s fcmpg v0 check-type: check-acc-1 cases: - values: - '0x7fc00000' - values: - '0x7fc00001' - values: - '0x7fc00010' - values: - '0x7fffffff' - values: - '0xffffffff' - values: - '0x7ff81234' - values: # +Inf - '0x7f800000' description: Check fcmpg compares NaN with +Inf - values: # -Inf - '0xff800000' description: Check fcmpg compares NaN with -Inf - file-name: nan_numbers_1 isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] description: Check fcmpg compares NaN with various values. tags: ['irtoc_ignore'] code-template: | # test - check comparison of NaN with values fldai 0x7fc00000 # One of valid NaN values fmovi v0, %s fcmpg v0 check-type: check-acc-1 cases: - values: - '4e300' - values: - '0.0' - values: - '-1.0e20' - file-name: numbers_2 isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] code-template: | # test - check comparison of values fldai %s fmovi v0, %s movi v1, %s fcmpg v0 jne v1, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check fcmpg compares various values. tags: ['tsan', 'irtoc_ignore'] cases: - values: - '1.0' - '0.0' - '1' - values: - '12345679' - '12345678' - '1' - values: - '12345678' - '-12345678' - '1' - values: - '-1.0' - '0.0' - '-1' - values: - '-12345678' - '0.0' - '-1' - values: - '-12345678' - '12345678' - '-1' - values: - '-12345678' - '12345678' - '-1' - file-name: pinf isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] description: Check fcmpg compares positive Inf with various values. tags: ['irtoc_ignore'] code-template: | # test - check comparison of values # +Inf fldai 0x7f800000 fmovi v0, %s fcmpg v0 check-type: check-acc-1 cases: - values: - '1.0' - values: - '12345678' - values: - '-12345678' - values: - '-1.0' - values: - '4e30' - values: - '-4e30' - file-name: ninf isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] description: Check fcmpg compares negative Inf with various values. tags: ['irtoc_ignore'] code-template: | # test - check comparison of values # -Inf fldai 0xff800000 fmovi v0, %s fcmpg v0 check-type: check-acc-minus-1 cases: - values: - '1.0' - values: - '12345678' - values: - '-12345678' - values: - '-1.0' - values: - '4e30' - values: - '-4e30' - file-name: inf isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] tags: ['irtoc_ignore'] code-template: | # test - check comparison of values fldai %s # +Inf fmovi v0, %s movi v1, %s fcmpg v0 jne v1, set_failure ldai 0 return set_failure: ldai 1 return check-type: none cases: - values: # -Inf - '0xff800000' - '0x7f800000' - '-1' - values: - '0x7f800000' # -Inf - '0xff800000' - '+1' - file-name: incorrect_register isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] runner-options: [compile-failure] description: Check fcmpg with incorrect register numbers. code-template: | # fcmpg %s check-type: exit-positive cases: - values: [v256] - values: [a0] - values: [0] - values: ['1.1'] - values: [1.1] - file-name: applicable_register isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] runner-options: [compile-only] description: Check fcmpg with correct register numbers. code-template: | # fldai 0.0 %s check-type: exit-positive cases: - values: - '#{[*0..255].map do |i| " fmovi v#{i}, 0\n fcmpg v#{i}\n" end .join}' - file-name: type isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] verification: - v1_type - acc_type tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .record A {} .record B {} .record panda.String .record panda.Object .function i32 main() { %s *s fcmpg v0 check-type: exit-positive description: Check 'fcmpg' with incorrect register type. template-cases: - values: - movi v0, 0 - values: - fmovi v0, 0 exclude: [val] - values: - movi.64 v0, 0 - values: - fmovi.64 v0, 0 - values: - | # lda.type B sta.obj v0 - values: - | # lda.type B[] sta.obj v0 - values: - | # lda.type panda.String sta.obj v0 - values: - | # lda.str "string" sta.obj v0 - values: - | # movi v0, 10 newarr v0, v0, i32[] - values: - mov.null v0 cases: - values: - ldai 0 - values: - ldai.64 0 - values: - fldai 0 id: val - values: - fldai.64 0 - values: - | # lda.type A - values: - | # lda.type A[] - values: - | # lda.type panda.String - values: - | # lda.str "string" - values: - | # movi v1, 10 newarr v1, v1, f64[] lda.obj v1 - values: - lda.null - file-name: uninitialized_regs isa: instructions: - sig: fcmpg v:in:f32 acc: inout:f32->i32 prefix: f32 format: [pref_op_v_8] description: Check 'fcmpg' with uninitialized registers. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .function i32 main() { %s *s fcmpg %s check-type: exit-positive template-cases: - values: - '' - v0 - values: - fmovi v0, 0 - v0 exclude: [init] - values: - '' - v7 - values: - '' - v15 - values: - 'fmovi v15, 0' - v15 exclude: [init] - values: - '' - v128 - values: - 'fmovi v128, 0' - v128 exclude: [init] - values: - '' - v255 - values: - 'fmovi v255, 0' - v255 exclude: [init] cases: - values: - '' - values: - fldai 0 id: init