Skip to content

Commit 0fe85e0

Browse files
michaelrj-googleZijunZhaoCCK
authored andcommitted
[libc] Move long double table option to new config (llvm#66151)
This patch adds the long double table option for printf into the new configuration scheme. This allows it to be set for most targets but unset for baremetal.
1 parent 023bbe4 commit 0fe85e0

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

libc/config/baremetal/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
},
99
"LIBC_CONF_PRINTF_DISABLE_WRITE_INT": {
1010
"value": true
11+
},
12+
"LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE": {
13+
"value": false
1114
}
1215
}
1316
}

libc/config/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"LIBC_CONF_PRINTF_DISABLE_WRITE_INT": {
1212
"value": false,
1313
"doc": "Disable handling of %n in printf format string."
14+
},
15+
"LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE": {
16+
"value": true,
17+
"doc": "Use large table for better printf long double performance."
1418
}
1519
}
1620
}

libc/docs/configure.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ to learn about the defaults for your platform and target.
2929
- ``LIBC_CONF_PRINTF_DISABLE_FLOAT``: Disable printing floating point values in printf and friends.
3030
- ``LIBC_CONF_PRINTF_DISABLE_INDEX_MODE``: Disable index mode in the printf format string.
3131
- ``LIBC_CONF_PRINTF_DISABLE_WRITE_INT``: Disable handling of %n in printf format string.
32+
- ``LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE``: Use large table for better printf long double performance.

libc/src/stdio/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ endif()
363363
if(LIBC_CONF_PRINTF_DISABLE_WRITE_INT)
364364
list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_WRITE_INT")
365365
endif()
366+
if(LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE)
367+
list(APPEND printf_copts "-DLIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE")
368+
endif()
366369

367370
if(LLVM_LIBC_FULL_BUILD)
368371
list(APPEND printf_deps

libc/src/stdio/printf_core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ add_object_library(
9292
libc.src.__support.integer_to_string
9393
libc.src.__support.float_to_string
9494
COMPILE_OPTIONS
95-
-DLIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE
9695
${printf_copts}
9796
)
9897

0 commit comments

Comments
 (0)