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 14# assert(5 * 2.5 == 12.5) operation --> fmul2.64 15.function i32 main(){ 16 fldai.64 5.0 17 fmovi.64 v0, 2.5 18 fmul2.64 v0 19 fmovi.64 v0, 12.5 20 fsub2.64 v0 21 sta.64 v0 22 call.short abs, v0, v0 23 fmovi.64 v0, 1e-13 24 fcmpl.64 v0 25 jgtz exit_failure 26 ldai 0 27 return 28exit_failure: 29 ldai 1 30 return 31} 32 33.function f64 abs(f64 a0){ 34 fldai.64 0.0 35 fcmpl.64 a0 36 jlez label 37 lda.64 a0 38 fneg.64 39 return.64 40label: 41 lda.64 a0 42 return.64 43} 44