# 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.
# fmod(a0, a1) == a2
.function i32 fmod(f64 a0, f64 a1, f64 a2) {
lda.64 a0
fmod2.64 a1
fcmpl.64 a2
return
}
.function i32 main() {
fmovi.64 v0, 5.3
fmovi.64 v1, 2.0
fmovi.64 v2, 1.2999999999999998
call fmod, v0, v1, v2
jnez end
fmovi.64 v0, -18.5
fmovi.64 v1, 4.2
fmovi.64 v2, -1.6999999999999993
call fmod, v0, v1, v2
jnez end
fmovi.64 v0, 2.1
fmovi.64 v1, 4.2
fmovi.64 v2, 2.1
call fmod, v0, v1, v2
jnez end
fmovi.64 v0, 18.5
fmovi.64 v1, 4.2
fmovi.64 v2, 1.6999999999999993
call fmod, v0, v1, v2
jnez end
fmovi.64 v0, 4.0
fmovi.64 v1, 4.0
fmovi.64 v2, 0.0
call fmod, v0, v1, v2
end:
return
}