diff --git a/compiler/intrinsics_can_encode.inl b/compiler/intrinsics_can_encode.inl new file mode 100644 index 0000000000000000000000000000000000000000..5f3ae61fbb76930f2699b8943a1ae81ebb42d0ea --- /dev/null +++ b/compiler/intrinsics_can_encode.inl @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2023 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. + */ + +inline bool CheckSSE42([[maybe_unused]] RuntimeInterface *runtime, Arch arch) +{ + if (arch == Arch::X86_64) { + return OPTIONS.IsCpuFeatureEnabled(SSE42); + } + return true; +} diff --git a/compiler/optimizer/templates/intrinsics/intrinsics_can_encode.inl.erb b/compiler/optimizer/templates/intrinsics/intrinsics_can_encode.inl.erb index 296b32b8ffb2365968718f6ba0f7055226cf61db..937d58d7b42dfdf2f71dc5c9f4fb14d9e4dedc8a 100644 --- a/compiler/optimizer/templates/intrinsics/intrinsics_can_encode.inl.erb +++ b/compiler/optimizer/templates/intrinsics/intrinsics_can_encode.inl.erb @@ -21,3 +21,5 @@ #include "<%= plugin_opts["Intrinsics"]["can_encode_inl"] %>" % end % end +% # the shared/core part of the encoder checkers +#include "compiler/intrinsics_can_encode.inl" diff --git a/plugins/ets/runtime/ets_libbase_runtime.yaml b/plugins/ets/runtime/ets_libbase_runtime.yaml index fb7a2b6ff31b146009e61f0220ec18e227bdedeb..921f34877c14a18084ca4d0c5a0b7d5a0acf9bc0 100644 --- a/plugins/ets/runtime/ets_libbase_runtime.yaml +++ b/plugins/ets/runtime/ets_libbase_runtime.yaml @@ -290,6 +290,7 @@ intrinsics: args: [ f64 ] impl: panda::ets::intrinsics::StdMathFloor codegen_func: CreateMathFloor + can_encode_func: CheckSSE42 clear_flags: [ no_dce, no_hoist, no_cse, barrier, require_state, runtime_call ] - name: StdMathRound @@ -302,6 +303,7 @@ intrinsics: args: [ f64 ] impl: panda::ets::intrinsics::StdMathRound codegen_func: CreateMathRoundAway + can_encode_func: CheckSSE42 clear_flags: [ no_dce, no_hoist, no_cse, barrier, require_state, runtime_call ] - name: StdMathTrunc @@ -314,6 +316,7 @@ intrinsics: args: [ f64 ] impl: panda::ets::intrinsics::StdMathTrunc codegen_func: CreateMathTrunc + can_encode_func: CheckSSE42 clear_flags: [ no_dce, no_hoist, no_cse, barrier, require_state, runtime_call ] - name: StdMathCeil @@ -326,6 +329,7 @@ intrinsics: args: [ f64 ] impl: panda::ets::intrinsics::StdMathCeil codegen_func: CreateMathCeil + can_encode_func: CheckSSE42 clear_flags: [ no_dce, no_hoist, no_cse, barrier, require_state, runtime_call ] - name: StdMathLog