summaryrefslogtreecommitdiff
path: root/core/riscv-rv32i/__builtin.c
diff options
context:
space:
mode:
authorDino Li <Dino.Li@ite.com.tw>2019-06-10 16:26:36 +0800
committerCommit Bot <commit-bot@chromium.org>2019-06-11 17:26:38 +0000
commit59d060ebfe68082f4ea87214ffcda976c55176af (patch)
treee237e25e9979220a716b72b65d43fb559504bc60 /core/riscv-rv32i/__builtin.c
parent3a668749460466ff002b5dd2cbf00529f97e5974 (diff)
downloadchrome-ec-59d060ebfe68082f4ea87214ffcda976c55176af.tar.gz
core:RISC-V / chip:IT83202
The IT83202 is an embedded controller with RISC-V core. It supports maximum ram size to 256KB and internal flash to 1MB. BUG=none BRANCH=none TEST=EC boots and test console commands (eg: taskinfo, version, sysjump...) on it83202 EVB. Change-Id: I424c0d2878beb941c816363b5c7a3f57fda9fd13 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1588300 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'core/riscv-rv32i/__builtin.c')
-rw-r--r--core/riscv-rv32i/__builtin.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/riscv-rv32i/__builtin.c b/core/riscv-rv32i/__builtin.c
new file mode 100644
index 0000000000..4bf495a011
--- /dev/null
+++ b/core/riscv-rv32i/__builtin.c
@@ -0,0 +1,16 @@
+/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+/*
+ * __builtin_ffs:
+ * Returns one plus the index of the least significant 1-bit of x,
+ * or if x is zero, returns zero.
+ */
+int __keep __ffssi2(int x)
+{
+ return 32 - __builtin_clz(x & -x);
+}