os-rust/compiler
Alex Crichton de2a4601ab rustc: Use LLVM's new saturating float-to-int intrinsics
This commit updates rustc, with an applicable LLVM version, to use
LLVM's new `llvm.fpto{u,s}i.sat.*.*` intrinsics to implement saturating
floating-point-to-int conversions. This results in a little bit tighter
codegen for x86/x86_64, but the main purpose of this is to prepare for
upcoming changes to the WebAssembly backend in LLVM where wasm's
saturating float-to-int instructions will now be implemented with these
intrinsics.

This change allows simplifying a good deal of surrounding code, namely
removing a lot of wasm-specific behavior. WebAssembly no longer has any
special-casing of saturating arithmetic instructions and the need for
`fptoint_may_trap` is gone and all handling code for that is now
removed. This means that the only wasm-specific logic is in the
`fpto{s,u}i` instructions which only get used for "out of bounds is
undefined behavior". This does mean that for the WebAssembly target
specifically the Rust compiler will no longer be 100% compatible with
pre-LLVM 12 versions, but it seems like that's unlikely to be relied on
by too many folks.

Note that this change does immediately regress the codegen of saturating
float-to-int casts on WebAssembly due to the specialization of the LLVM
intrinsic not being present in our LLVM fork just yet. I'll be following
up with an LLVM update to pull in those patches, but affects a few other
SIMD things in flight for WebAssembly so I wanted to separate this change.

Eventually the entire `cast_float_to_int` function can be removed when
LLVM 12 is the minimum version, but that will require sinking the
complexity of it into other backends such as Cranelfit.
2021-04-21 07:15:53 -07:00
..
rustc use jemallocator in rustc/rustdoc 2021-04-04 14:10:26 -07:00
rustc_apfloat Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_arena Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_ast Implement token-based handling of attributes during expansion 2021-04-11 01:31:36 -04:00
rustc_ast_lowering Implement token-based handling of attributes during expansion 2021-04-11 01:31:36 -04:00
rustc_ast_passes Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearth 2021-04-18 23:28:43 +00:00
rustc_ast_pretty Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
rustc_attr Allow specifying alignment for functions 2021-04-05 17:36:51 -04:00
rustc_builtin_macros builtin derive macros: fix error with const generics default 2021-04-16 16:29:11 +02:00
rustc_codegen_cranelift Add more SIMD math.h intrinsics 2021-04-14 15:25:06 -07:00
rustc_codegen_llvm rustc: Use LLVM's new saturating float-to-int intrinsics 2021-04-21 07:15:53 -07:00
rustc_codegen_ssa rustc: Use LLVM's new saturating float-to-int intrinsics 2021-04-21 07:15:53 -07:00
rustc_data_structures Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_driver Rollup merge of #83895 - eggyal:issue-83883, r=jyn514 2021-04-06 17:42:31 +02:00
rustc_error_codes Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearth 2021-04-18 23:28:43 +00:00
rustc_errors Document compiler/ with -Aprivate-intra-doc-links 2021-04-05 08:38:09 -04:00
rustc_expand Implement token-based handling of attributes during expansion 2021-04-11 01:31:36 -04:00
rustc_feature Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearth 2021-04-18 23:28:43 +00:00
rustc_fs_util Optimize away a fs::metadata call. 2021-01-06 08:33:15 -08:00
rustc_graphviz Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_hir Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_hir_pretty Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
rustc_incremental Also profile finishing the encoding. 2021-03-30 18:10:08 +02:00
rustc_index Add fixme comment to revert change once const_panic is stable 2021-04-03 13:07:03 +02:00
rustc_infer Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_interface Track -C link-dead-code during incremental compilation 2021-04-15 15:05:26 -04:00
rustc_lexer Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_lint Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearth 2021-04-18 23:28:43 +00:00
rustc_lint_defs Update docs for unsafe_op_in_unsafe_fn stability. 2021-04-14 08:28:40 -07:00
rustc_llvm Don't set fast(-math) for certain simd ops 2021-04-17 23:33:10 +03:00
rustc_macros Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_metadata Rollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa 2021-04-05 00:24:33 +02:00
rustc_middle Mark has_global_allocator query as eval_always 2021-04-16 16:28:54 -04:00
rustc_mir Compiler error messages: reduce assertiveness of message E0384 2021-04-12 23:29:09 +01:00
rustc_mir_build move new c abi abort behavior behind feature gate 2021-04-13 09:55:21 -04:00
rustc_parse Auto merge of #84130 - Aaron1011:fix/none-delim-lookahead, r=petrochenkov 2021-04-14 20:45:23 +00:00
rustc_parse_format Rollup merge of #83348 - osa1:issue83344, r=jackh726 2021-03-28 01:33:13 +09:00
rustc_passes Remove #[main] attribute. 2021-04-16 13:04:02 +08:00
rustc_plugin_impl Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00
rustc_privacy Update with comments 2021-03-23 17:16:20 +00:00
rustc_query_impl Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_query_system Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_resolve Auto merge of #84113 - SNCPlay42:suggestion-extern-crate, r=petrochenkov 2021-04-17 02:23:10 +00:00
rustc_save_analysis Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_serialize Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot 2021-03-26 01:28:59 +00:00
rustc_session Track -C link-dead-code during incremental compilation 2021-04-15 15:05:26 -04:00
rustc_span rustc: Use LLVM's new saturating float-to-int intrinsics 2021-04-21 07:15:53 -07:00
rustc_symbol_mangling Rollup merge of #80525 - devsnek:wasm64, r=nagisa 2021-04-05 00:24:23 +02:00
rustc_target Avoid an Option<Option<_>> 2021-04-13 18:42:19 +02:00
rustc_trait_selection Improve an error message. 2021-04-18 20:38:23 +01:00
rustc_traits Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_ty_utils Track bound vars 2021-03-31 10:15:27 -04:00
rustc_type_ir Remove nightly features in rustc_type_ir 2021-04-03 10:00:09 +02:00
rustc_typeck Auto merge of #84244 - ABouttefeux:closure-return-conflict-suggest, r=estebank 2021-04-17 07:17:31 +00:00