Skip to content
Snippets Groups Projects
Commit f262c1b3 authored by Chris Blume's avatar Chris Blume Committed by Commit Bot
Browse files

Remove use of inline ASM in insert_string_sse

It seems that some years ago clang@Windows didn't have the
proper intrinsic required, which prompted the use of inline
ASM.

It has a side effect in that it will allow compilation of the
optimized function within the same compilation unit while using regular
compiler flags (i.e. 'crc32' instruction on x86 requires some special
compiler flags).

Main issue is that inline ASM is blocked on dependencies (e.g. 'base')
that will be linked to NaCl.

The main idea here is to allow the whole Chromium code base to use the
highly optimized checksums in zlib (e.g. crc32 and Adler-32), exported
through an interface (i.e. base::Crc32()).

This patch fixes this issue by removing the use of inline ASM.

The workaround is to use clang/gcc 'target attributes' to instruct the
backend to use different code generation options for the optimized
function, see:
https://clang.llvm.org/docs/AttributeReference.html#target

NOTE: While testing on my personal Windows PC, VS2019 including
smmintrin.h was insufficient. I needed to explicitly include either
immintrin.h or nmmintrin.h. I expected I would need that, but it seems
to be working with just smmintrin.h.

Bug: 902789
Change-Id: Id692fb839e20b26f9ba8b45538e652d5b140cd36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1941688


Commit-Queue: Chris Blume <cblume@chromium.org>
Reviewed-by: default avatarAdenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#721425}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1cebcd57bc3d09c39783395e6b173ff1f358a91b
parent e77e1c06
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment