This commit is contained in:
Chiel92 2013-07-07 22:37:10 +02:00
commit 34c24129d2
45 changed files with 6025 additions and 10436 deletions

View File

@ -7,7 +7,7 @@ YCM to work on my machine" and the reason why is obviously related to your
machine configuration and the problem would not be resolved with _reasonable_
changes to the YCM codebase, then the issue is likely to be closed.
YCM compiles just fine; [the build bots say so][build-bots]. If the bots are
**YCM compiles just fine**; [the build bots say so][build-bots]. If the bots are
green and YCM doesn't compile on your machine, then _your machine is the root
cause_. Now read the previous paragraph again.

View File

@ -207,9 +207,10 @@ notify you to recompile it. You should then rerun the install process.
**Download the latest version of `libclang`**. Clang is an open-source
compiler that can compile C/C++/Objective-C/Objective-C++. The `libclang`
library it provides is used to power the YCM semantic completion engine for
those languages. YCM needs libclang version 3.2 or higher.
those languages. YCM is designed to work with libclang version 3.3 or
higher, but can in theory work with 3.2 as well.
You can use the system libclang _only if you are sure it is version 3.2 or
You can use the system libclang _only if you are sure it is version 3.3 or
higher_, otherwise don't. Even if it is, I recommend using the [official
binaries from llvm.org][clang-download] if at all possible. Make sure you
download the correct archive file for your OS.
@ -597,6 +598,21 @@ Default: `2`
let g:ycm_min_num_of_chars_for_completion = 2
### The `g:ycm_min_num_identifier_candidate_chars` option
This option controls the minimum number of characters that a completion
candidate coming from the identifier completer must have to be shown in the
popup menu.
A special value of `0` means there is no limit.
NOTE: This option only applies to the identifier completer; it has no effect on
the various semantic completers.
Default: `0`
let g:ycm_min_num_identifier_candidate_chars = 0
### The `g:ycm_filetype_whitelist` option
This option controls for which Vim filetypes (see `:h filetype`) should YCM be
@ -952,6 +968,10 @@ completion engines. The option holds a dictionary of key-values, where the keys
are Vim's filetype strings delimited by commas and values are lists of strings,
where the strings are the triggers.
Setting key-value pairs on the dictionary _adds_ semantic triggers to the
internal default set (listed below). You cannot remove the default triggers,
only add new ones.
A "trigger" is a sequence of one or more characters that trigger semantic
completion when typed. For instance, C++ (`cpp` filetype) has `.` listed as a
trigger. So when the user types `foo.`, the semantic engine will trigger and
@ -967,7 +987,8 @@ Default: `[see next line]`
\ 'cpp,objcpp' : ['->', '.', '::'],
\ 'perl' : ['->'],
\ 'php' : ['->', '::'],
\ 'cs,java,javascript,d,vim,ruby,python,perl6,scala,vb,elixir,go' : ['.'],
\ 'cs,java,javascript,d,vim,python,perl6,scala,vb,elixir,go' : ['.'],
\ 'ruby' : ['.', '::'],
\ 'lua' : ['.', ':'],
\ 'erlang' : [':'],
\ }
@ -1047,6 +1068,10 @@ Vundle, make sure that your bundle command is `Bundle 'scrooloose/syntastic'`
and **not** `Bundle 'Syntastic'`. The first command pulls in the latest version of
Syntastic from GitHub while the second one pulls in an old version from vim.org.
Because of [a Vundle bug][vundle-bug], make sure you have completely removed
everything in your Vundle bundle directory (`~/.vim/bundle` by default) before
switching from one Syntastic bundle command to the other.
### YCM auto-inserts completion strings I don't want!
This means you probably have some mappings that interfere with YCM's internal
@ -1129,6 +1154,24 @@ to use. You may need to set these flags to something else, but you need to make
sure you use the same version of Python that your Vim binary is built against,
which is highly likely to be the system's default Python.
### I get `libpython2.7.a [...] relocation R_X86_64_32` when compiling
The error is usually encountered when compiling YCM on Centos or RHEL. The full
error looks something like the following:
```
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
```
It's possible to get a slightly different error that's similar to the one above.
Here's the problem and how you solve it:
Your `libpython2.7.a` was not compiled with `-fPIC` so it can't be linked into
`ycm_core.so`. Use the `-DPYTHON_LIBRARY=` CMake flag to point it to a `.so`
version of libpython on your machine (for instance,
`-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so`). Naturally, this means you'll have
to go through the full installation guide by hand.
### I get `Vim: Caught deadly signal SEGV` on Vim startup
This can happen on some Linux distros. If you encounter this situation, run Vim
@ -1174,6 +1217,17 @@ YCM keeps you in a `completefunc` completion mode when you're typing in insert
mode and Vim disables `<C-U>` in completion mode as a "feature." Sadly there's
nothing I can do about this.
### YCM conflicts with UltiSnips TAB key usage
YCM comes with support for UltiSnips (snippet suggestions in the popup menu),
but you'll have to change the UltiSnips mappings. See `:h UltiSnips-triggers` in
Vim for details. You'll probably want to change some/all of the following
options:
g:UltiSnipsExpandTrigger
g:UltiSnipsJumpForwardTrigger
g:UltiSnipsJumpBackwardTrigger
### Why isn't YCM just written in plain VimScript, FFS?
Because of the identifier completion engine and subsequence-based filtering.
@ -1230,7 +1284,7 @@ This software is licensed under the [GPL v3 license][gpl].
[Clang]: http://clang.llvm.org/
[vundle]: https://github.com/gmarik/vundle#about
[pathogen]: https://github.com/tpope/vim-pathogen#pathogenvim
[clang-download]: http://llvm.org/releases/download.html#3.2
[clang-download]: http://llvm.org/releases/download.html#3.3
[brew]: http://mxcl.github.com/homebrew/
[cmake-download]: http://www.cmake.org/cmake/resources/software.html
[macvim]: http://code.google.com/p/macvim/#Download
@ -1253,3 +1307,4 @@ This software is licensed under the [GPL v3 license][gpl].
[ultisnips]: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt
[exuberant-ctags]: http://ctags.sourceforge.net/
[ctags-format]: http://ctags.sourceforge.net/FORMAT
[vundle-bug]: https://github.com/gmarik/vundle/issues/48

View File

@ -207,6 +207,7 @@ function! s:SetUpCompleteopt()
endfunction
function! s:OnVimLeave()
py ycm_state.OnVimLeave()
py extra_conf_store.CallExtraConfVimCloseIfExists()
endfunction
@ -380,7 +381,8 @@ endfunction
function! s:UpdateDiagnosticNotifications()
if get( g:, 'loaded_syntastic_plugin', 0 ) &&
\ pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' ) &&
\ pyeval( 'ycm_state.DiagnosticsForCurrentFileReady()' )
\ pyeval( 'ycm_state.DiagnosticsForCurrentFileReady()' ) &&
\ g:ycm_register_as_syntastic_checker
SyntasticCheck
endif
endfunction
@ -484,7 +486,7 @@ function! s:CompletionsForQuery( query, use_filetype_completer,
endif
endwhile
let l:results = pyeval( 'completer.CandidatesFromStoredRequest()' )
let l:results = pyeval( 'base.AdjustCandidateInsertionText( completer.CandidatesFromStoredRequest() )' )
let s:searched_and_results_found = len( l:results ) != 0
return { 'words' : l:results, 'refresh' : 'always' }
endfunction

View File

@ -115,8 +115,6 @@ endif()
# Special compiler and linker flags for MSVC
if( MSVC )
add_definitions( /DUNICODE /D_UNICODE /Zc:wchar_t- )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" )
set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
endif()

View File

@ -82,6 +82,12 @@ elseif( COMPILER_IS_CLANG )
set( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
endif()
# For MSVC enable UNICODE and compilation on multiple processors
if( MSVC )
add_definitions( /DUNICODE /D_UNICODE /Zc:wchar_t- )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
endif()
# When used with Clang, adding the -std=c++0x flag to CMAKE_CXX_FLAGS will cause
# the compiler to output a warning during linking:
# clang: warning: argument unused during compilation: '-std=c++0x'

View File

@ -29,36 +29,40 @@ if ( NOT PYTHONLIBS_VERSION_STRING VERSION_LESS "3.0.0" )
endif()
option( USE_CLANG_COMPLETER "Use Clang semantic completer for C/C++/ObjC" OFF )
option( PATH_TO_LLVM_ROOT "Path to the root of a LLVM+Clang binary distribution" )
option( USE_SYSTEM_LIBCLANG "Set to ON to use the system libclang library" OFF )
option( EXTERNAL_LIBCLANG_PATH "Path libclang library to use" )
set( PATH_TO_LLVM_ROOT "" CACHE PATH "Path to the root of a LLVM+Clang binary distribution" )
set( EXTERNAL_LIBCLANG_PATH "" CACHE PATH "Path libclang library to use" )
if ( USE_CLANG_COMPLETER AND NOT USE_SYSTEM_LIBCLANG AND NOT PATH_TO_LLVM_ROOT )
message( "Downloading Clang 3.2" )
message( "Downloading Clang 3.3" )
set( CLANG_URL "http://llvm.org/releases/3.2" )
set( CLANG_URL "http://llvm.org/releases/3.3" )
if ( APPLE )
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-apple-darwin11" )
set( CLANG_MD5 "fbdca3b4e8cdaa2352f2aeb038a16532" )
set( CLANG_DIRNAME "clang+llvm-3.3-x86_64-apple-darwin12" )
set( CLANG_MD5 "3c9984ca05f68ca5dc7e06dad92a96ab" )
set( CLANG_FILENAME "${CLANG_DIRNAME}.tar.gz" )
else()
if ( 64_BIT_PLATFORM )
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" )
set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" )
set( CLANG_DIRNAME "clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu" )
set( CLANG_MD5 "c0cbbe86c5836e03fe6eb96e95d059fa" )
else()
set( CLANG_DIRNAME "clang+llvm-3.2-x86-linux-ubuntu-12.04" )
set( CLANG_MD5 "cea2d01b3206e92a8df7b079935c070b" )
set( CLANG_DIRNAME "clang+llvm-3.3-Ubuntu-13.04-x86-linux-gnu" )
set( CLANG_MD5 "1478157ffdf583461fe9c377398cccf3" )
endif()
set( CLANG_FILENAME "${CLANG_DIRNAME}.tar.bz2" )
endif()
set( CLANG_FILENAME "${CLANG_DIRNAME}.tar.gz" )
file(
DOWNLOAD "${CLANG_URL}/${CLANG_FILENAME}" "./${CLANG_FILENAME}"
SHOW_PROGRESS EXPECTED_MD5 "${CLANG_MD5}"
)
if ( CLANG_FILENAME MATCHES ".+bz2" )
execute_process( COMMAND tar -xjf ${CLANG_FILENAME} )
else()
execute_process( COMMAND tar -xzf ${CLANG_FILENAME} )
endif()
# And set PATH_TO_LLVM_ROOT
set( PATH_TO_LLVM_ROOT "${CMAKE_CURRENT_BINARY_DIR}/../${CLANG_DIRNAME}" )
@ -104,7 +108,7 @@ endif()
if ( NOT EXTERNAL_LIBCLANG_PATH AND PATH_TO_LLVM_ROOT )
# Need TEMP because find_library does not work with an option variable
find_library( TEMP clang
find_library( TEMP NAMES clang libclang
PATHS ${PATH_TO_LLVM_ROOT}/lib
NO_DEFAULT_PATH )
set( EXTERNAL_LIBCLANG_PATH ${TEMP} )
@ -231,12 +235,19 @@ target_link_libraries( ${PROJECT_NAME}
${EXTRA_LIBS}
)
if ( LIBCLANG_TARGET )
if( LIBCLANG_TARGET )
if( NOT WIN32 )
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND cp "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
else()
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${PATH_TO_LLVM_ROOT}/bin/libclang.dll" "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endif()
endif()
#############################################################################

View File

@ -166,7 +166,7 @@ FiletypeIdentifierMap ExtractIdentifiersFromTagsFile(
continue;
std::string identifier( matches[ 1 ] );
fs::path path( matches[ 2 ] );
fs::path path( matches[ 2 ].str() );
if ( path.is_relative() )
path = path_to_tag_file.parent_path() / path;

View File

@ -21,11 +21,13 @@ set cpo&vim
if exists( "g:loaded_youcompleteme" )
finish
elseif v:version < 703 || !has( 'patch584' )
elseif v:version < 704
if v:version < 703 || !has( 'patch584' )
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim 7.3.584+" |
\ echohl None
finish
endif
elseif !has( 'python' )
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires python 2.x" |
@ -41,6 +43,8 @@ function! s:HasYcmCore()
return 1
elseif filereadable(path_prefix . 'ycm_core.pyd')
return 1
elseif filereadable(path_prefix . 'ycm_core.dll')
return 1
endif
return 0
endfunction
@ -50,8 +54,8 @@ let g:ycm_check_if_ycm_core_present =
if g:ycm_check_if_ycm_core_present && !s:HasYcmCore()
echohl WarningMsg |
\ echomsg "ycm_core.[so|pyd] not detected; you need to compile YCM " .
\ "before using it. Read the docs!" |
\ echomsg "ycm_core.[so|pyd|dll] not detected; you need to compile " .
\ "YCM before using it. Read the docs!" |
\ echohl None
finish
endif
@ -61,6 +65,9 @@ let g:loaded_youcompleteme = 1
let g:ycm_min_num_of_chars_for_completion =
\ get( g:, 'ycm_min_num_of_chars_for_completion', 2 )
let g:ycm_min_num_identifier_candidate_chars =
\ get( g:, 'ycm_min_num_identifier_candidate_chars', 0 )
let g:ycm_filetype_whitelist =
\ get( g:, 'ycm_filetype_whitelist', {
\ '*' : 1,
@ -136,18 +143,10 @@ let g:ycm_extra_conf_globlist =
let g:ycm_filepath_completion_use_working_dir =
\ get( g:, 'ycm_filepath_completion_use_working_dir', 0 )
" Default semantic triggers are in python/ycm/completers/completer.py, these
" just append new triggers to the default dict.
let g:ycm_semantic_triggers =
\ get( g:, 'ycm_semantic_triggers', {
\ 'c' : ['->', '.'],
\ 'objc' : ['->', '.'],
\ 'ocaml' : ['.', '#'],
\ 'cpp,objcpp' : ['->', '.', '::'],
\ 'perl' : ['->'],
\ 'php' : ['->', '::'],
\ 'cs,java,javascript,d,vim,ruby,python,perl6,scala,vb,elixir,go' : ['.'],
\ 'lua' : ['.', ':'],
\ 'erlang' : [':'],
\ } )
\ get( g:, 'ycm_semantic_triggers', {} )
let g:ycm_cache_omnifunc =
\ get( g:, 'ycm_cache_omnifunc', 1 )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,39 +29,39 @@
#define _mm256_mpsadbw_epu8(X, Y, M) __builtin_ia32_mpsadbw256((X), (Y), (M))
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_abs_epi8(__m256i a)
_mm256_abs_epi8(__m256i __a)
{
return (__m256i)__builtin_ia32_pabsb256((__v32qi)a);
return (__m256i)__builtin_ia32_pabsb256((__v32qi)__a);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_abs_epi16(__m256i a)
_mm256_abs_epi16(__m256i __a)
{
return (__m256i)__builtin_ia32_pabsw256((__v16hi)a);
return (__m256i)__builtin_ia32_pabsw256((__v16hi)__a);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_abs_epi32(__m256i a)
_mm256_abs_epi32(__m256i __a)
{
return (__m256i)__builtin_ia32_pabsd256((__v8si)a);
return (__m256i)__builtin_ia32_pabsd256((__v8si)__a);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_packs_epi16(__m256i a, __m256i b)
_mm256_packs_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_packsswb256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_packsswb256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_packs_epi32(__m256i a, __m256i b)
_mm256_packs_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_packssdw256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_packssdw256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_packus_epi16(__m256i a, __m256i b)
_mm256_packus_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_packuswb256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_packuswb256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
@ -71,51 +71,51 @@ _mm256_packus_epi32(__m256i __V1, __m256i __V2)
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_add_epi8(__m256i a, __m256i b)
_mm256_add_epi8(__m256i __a, __m256i __b)
{
return (__m256i)((__v32qi)a + (__v32qi)b);
return (__m256i)((__v32qi)__a + (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_add_epi16(__m256i a, __m256i b)
_mm256_add_epi16(__m256i __a, __m256i __b)
{
return (__m256i)((__v16hi)a + (__v16hi)b);
return (__m256i)((__v16hi)__a + (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_add_epi32(__m256i a, __m256i b)
_mm256_add_epi32(__m256i __a, __m256i __b)
{
return (__m256i)((__v8si)a + (__v8si)b);
return (__m256i)((__v8si)__a + (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_add_epi64(__m256i a, __m256i b)
_mm256_add_epi64(__m256i __a, __m256i __b)
{
return a + b;
return __a + __b;
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_adds_epi8(__m256i a, __m256i b)
_mm256_adds_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_paddsb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_paddsb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_adds_epi16(__m256i a, __m256i b)
_mm256_adds_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_paddsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_paddsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_adds_epu8(__m256i a, __m256i b)
_mm256_adds_epu8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_paddusb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_paddusb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_adds_epu16(__m256i a, __m256i b)
_mm256_adds_epu16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_paddusw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_paddusw256((__v16hi)__a, (__v16hi)__b);
}
#define _mm256_alignr_epi8(a, b, n) __extension__ ({ \
@ -124,27 +124,27 @@ _mm256_adds_epu16(__m256i a, __m256i b)
(__m256i)__builtin_ia32_palignr256((__v32qi)__a, (__v32qi)__b, (n)); })
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_and_si256(__m256i a, __m256i b)
_mm256_and_si256(__m256i __a, __m256i __b)
{
return a & b;
return __a & __b;
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_andnot_si256(__m256i a, __m256i b)
_mm256_andnot_si256(__m256i __a, __m256i __b)
{
return ~a & b;
return ~__a & __b;
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_avg_epu8(__m256i a, __m256i b)
_mm256_avg_epu8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pavgb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pavgb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_avg_epu16(__m256i a, __m256i b)
_mm256_avg_epu16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pavgw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pavgw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
@ -160,177 +160,177 @@ _mm256_blendv_epi8(__m256i __V1, __m256i __V2, __m256i __M)
(__m256i)__builtin_ia32_pblendw256((__v16hi)__V1, (__v16hi)__V2, (M)); })
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpeq_epi8(__m256i a, __m256i b)
_mm256_cmpeq_epi8(__m256i __a, __m256i __b)
{
return (__m256i)((__v32qi)a == (__v32qi)b);
return (__m256i)((__v32qi)__a == (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpeq_epi16(__m256i a, __m256i b)
_mm256_cmpeq_epi16(__m256i __a, __m256i __b)
{
return (__m256i)((__v16hi)a == (__v16hi)b);
return (__m256i)((__v16hi)__a == (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpeq_epi32(__m256i a, __m256i b)
_mm256_cmpeq_epi32(__m256i __a, __m256i __b)
{
return (__m256i)((__v8si)a == (__v8si)b);
return (__m256i)((__v8si)__a == (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpeq_epi64(__m256i a, __m256i b)
_mm256_cmpeq_epi64(__m256i __a, __m256i __b)
{
return (__m256i)(a == b);
return (__m256i)(__a == __b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpgt_epi8(__m256i a, __m256i b)
_mm256_cmpgt_epi8(__m256i __a, __m256i __b)
{
return (__m256i)((__v32qi)a > (__v32qi)b);
return (__m256i)((__v32qi)__a > (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpgt_epi16(__m256i a, __m256i b)
_mm256_cmpgt_epi16(__m256i __a, __m256i __b)
{
return (__m256i)((__v16hi)a > (__v16hi)b);
return (__m256i)((__v16hi)__a > (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpgt_epi32(__m256i a, __m256i b)
_mm256_cmpgt_epi32(__m256i __a, __m256i __b)
{
return (__m256i)((__v8si)a > (__v8si)b);
return (__m256i)((__v8si)__a > (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_cmpgt_epi64(__m256i a, __m256i b)
_mm256_cmpgt_epi64(__m256i __a, __m256i __b)
{
return (__m256i)(a > b);
return (__m256i)(__a > __b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_hadd_epi16(__m256i a, __m256i b)
_mm256_hadd_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_phaddw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_phaddw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_hadd_epi32(__m256i a, __m256i b)
_mm256_hadd_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_phaddd256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_phaddd256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_hadds_epi16(__m256i a, __m256i b)
_mm256_hadds_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_phaddsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_phaddsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_hsub_epi16(__m256i a, __m256i b)
_mm256_hsub_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_phsubw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_phsubw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_hsub_epi32(__m256i a, __m256i b)
_mm256_hsub_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_phsubd256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_phsubd256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_hsubs_epi16(__m256i a, __m256i b)
_mm256_hsubs_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_phsubsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_phsubsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_maddubs_epi16(__m256i a, __m256i b)
_mm256_maddubs_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaddubsw256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pmaddubsw256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_madd_epi16(__m256i a, __m256i b)
_mm256_madd_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaddwd256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pmaddwd256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_max_epi8(__m256i a, __m256i b)
_mm256_max_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaxsb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pmaxsb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_max_epi16(__m256i a, __m256i b)
_mm256_max_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaxsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pmaxsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_max_epi32(__m256i a, __m256i b)
_mm256_max_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaxsd256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_pmaxsd256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_max_epu8(__m256i a, __m256i b)
_mm256_max_epu8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaxub256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pmaxub256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_max_epu16(__m256i a, __m256i b)
_mm256_max_epu16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaxuw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pmaxuw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_max_epu32(__m256i a, __m256i b)
_mm256_max_epu32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmaxud256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_pmaxud256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_min_epi8(__m256i a, __m256i b)
_mm256_min_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pminsb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pminsb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_min_epi16(__m256i a, __m256i b)
_mm256_min_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pminsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pminsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_min_epi32(__m256i a, __m256i b)
_mm256_min_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pminsd256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_pminsd256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_min_epu8(__m256i a, __m256i b)
_mm256_min_epu8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pminub256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pminub256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_min_epu16(__m256i a, __m256i b)
_mm256_min_epu16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pminuw256 ((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pminuw256 ((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_min_epu32(__m256i a, __m256i b)
_mm256_min_epu32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pminud256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_pminud256((__v8si)__a, (__v8si)__b);
}
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_mm256_movemask_epi8(__m256i a)
_mm256_movemask_epi8(__m256i __a)
{
return __builtin_ia32_pmovmskb256((__v32qi)a);
return __builtin_ia32_pmovmskb256((__v32qi)__a);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
@ -406,63 +406,63 @@ _mm256_cvtepu32_epi64(__m128i __V)
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mul_epi32(__m256i a, __m256i b)
_mm256_mul_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmuldq256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_pmuldq256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mulhrs_epi16(__m256i a, __m256i b)
_mm256_mulhrs_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmulhrsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pmulhrsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mulhi_epu16(__m256i a, __m256i b)
_mm256_mulhi_epu16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmulhuw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pmulhuw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mulhi_epi16(__m256i a, __m256i b)
_mm256_mulhi_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pmulhw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_pmulhw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mullo_epi16(__m256i a, __m256i b)
_mm256_mullo_epi16(__m256i __a, __m256i __b)
{
return (__m256i)((__v16hi)a * (__v16hi)b);
return (__m256i)((__v16hi)__a * (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mullo_epi32 (__m256i a, __m256i b)
_mm256_mullo_epi32 (__m256i __a, __m256i __b)
{
return (__m256i)((__v8si)a * (__v8si)b);
return (__m256i)((__v8si)__a * (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_mul_epu32(__m256i a, __m256i b)
_mm256_mul_epu32(__m256i __a, __m256i __b)
{
return __builtin_ia32_pmuludq256((__v8si)a, (__v8si)b);
return __builtin_ia32_pmuludq256((__v8si)__a, (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_or_si256(__m256i a, __m256i b)
_mm256_or_si256(__m256i __a, __m256i __b)
{
return a | b;
return __a | __b;
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sad_epu8(__m256i a, __m256i b)
_mm256_sad_epu8(__m256i __a, __m256i __b)
{
return __builtin_ia32_psadbw256((__v32qi)a, (__v32qi)b);
return __builtin_ia32_psadbw256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_shuffle_epi8(__m256i a, __m256i b)
_mm256_shuffle_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_pshufb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_pshufb256((__v32qi)__a, (__v32qi)__b);
}
#define _mm256_shuffle_epi32(a, imm) __extension__ ({ \
@ -502,21 +502,21 @@ _mm256_shuffle_epi8(__m256i a, __m256i b)
12, 13, 14, 15); })
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sign_epi8(__m256i a, __m256i b)
_mm256_sign_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psignb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_psignb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sign_epi16(__m256i a, __m256i b)
_mm256_sign_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psignw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_psignw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sign_epi32(__m256i a, __m256i b)
_mm256_sign_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psignd256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_psignd256((__v8si)__a, (__v8si)__b);
}
#define _mm256_slli_si256(a, count) __extension__ ({ \
@ -524,63 +524,63 @@ _mm256_sign_epi32(__m256i a, __m256i b)
(__m256i)__builtin_ia32_pslldqi256(__a, (count)*8); })
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_slli_epi16(__m256i a, int count)
_mm256_slli_epi16(__m256i __a, int __count)
{
return (__m256i)__builtin_ia32_psllwi256((__v16hi)a, count);
return (__m256i)__builtin_ia32_psllwi256((__v16hi)__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sll_epi16(__m256i a, __m128i count)
_mm256_sll_epi16(__m256i __a, __m128i __count)
{
return (__m256i)__builtin_ia32_psllw256((__v16hi)a, (__v8hi)count);
return (__m256i)__builtin_ia32_psllw256((__v16hi)__a, (__v8hi)__count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_slli_epi32(__m256i a, int count)
_mm256_slli_epi32(__m256i __a, int __count)
{
return (__m256i)__builtin_ia32_pslldi256((__v8si)a, count);
return (__m256i)__builtin_ia32_pslldi256((__v8si)__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sll_epi32(__m256i a, __m128i count)
_mm256_sll_epi32(__m256i __a, __m128i __count)
{
return (__m256i)__builtin_ia32_pslld256((__v8si)a, (__v4si)count);
return (__m256i)__builtin_ia32_pslld256((__v8si)__a, (__v4si)__count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_slli_epi64(__m256i a, int count)
_mm256_slli_epi64(__m256i __a, int __count)
{
return __builtin_ia32_psllqi256(a, count);
return __builtin_ia32_psllqi256(__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sll_epi64(__m256i a, __m128i count)
_mm256_sll_epi64(__m256i __a, __m128i __count)
{
return __builtin_ia32_psllq256(a, count);
return __builtin_ia32_psllq256(__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srai_epi16(__m256i a, int count)
_mm256_srai_epi16(__m256i __a, int __count)
{
return (__m256i)__builtin_ia32_psrawi256((__v16hi)a, count);
return (__m256i)__builtin_ia32_psrawi256((__v16hi)__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sra_epi16(__m256i a, __m128i count)
_mm256_sra_epi16(__m256i __a, __m128i __count)
{
return (__m256i)__builtin_ia32_psraw256((__v16hi)a, (__v8hi)count);
return (__m256i)__builtin_ia32_psraw256((__v16hi)__a, (__v8hi)__count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srai_epi32(__m256i a, int count)
_mm256_srai_epi32(__m256i __a, int __count)
{
return (__m256i)__builtin_ia32_psradi256((__v8si)a, count);
return (__m256i)__builtin_ia32_psradi256((__v8si)__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sra_epi32(__m256i a, __m128i count)
_mm256_sra_epi32(__m256i __a, __m128i __count)
{
return (__m256i)__builtin_ia32_psrad256((__v8si)a, (__v4si)count);
return (__m256i)__builtin_ia32_psrad256((__v8si)__a, (__v4si)__count);
}
#define _mm256_srli_si256(a, count) __extension__ ({ \
@ -588,141 +588,141 @@ _mm256_sra_epi32(__m256i a, __m128i count)
(__m256i)__builtin_ia32_psrldqi256(__a, (count)*8); })
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srli_epi16(__m256i a, int count)
_mm256_srli_epi16(__m256i __a, int __count)
{
return (__m256i)__builtin_ia32_psrlwi256((__v16hi)a, count);
return (__m256i)__builtin_ia32_psrlwi256((__v16hi)__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srl_epi16(__m256i a, __m128i count)
_mm256_srl_epi16(__m256i __a, __m128i __count)
{
return (__m256i)__builtin_ia32_psrlw256((__v16hi)a, (__v8hi)count);
return (__m256i)__builtin_ia32_psrlw256((__v16hi)__a, (__v8hi)__count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srli_epi32(__m256i a, int count)
_mm256_srli_epi32(__m256i __a, int __count)
{
return (__m256i)__builtin_ia32_psrldi256((__v8si)a, count);
return (__m256i)__builtin_ia32_psrldi256((__v8si)__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srl_epi32(__m256i a, __m128i count)
_mm256_srl_epi32(__m256i __a, __m128i __count)
{
return (__m256i)__builtin_ia32_psrld256((__v8si)a, (__v4si)count);
return (__m256i)__builtin_ia32_psrld256((__v8si)__a, (__v4si)__count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srli_epi64(__m256i a, int count)
_mm256_srli_epi64(__m256i __a, int __count)
{
return __builtin_ia32_psrlqi256(a, count);
return __builtin_ia32_psrlqi256(__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_srl_epi64(__m256i a, __m128i count)
_mm256_srl_epi64(__m256i __a, __m128i __count)
{
return __builtin_ia32_psrlq256(a, count);
return __builtin_ia32_psrlq256(__a, __count);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sub_epi8(__m256i a, __m256i b)
_mm256_sub_epi8(__m256i __a, __m256i __b)
{
return (__m256i)((__v32qi)a - (__v32qi)b);
return (__m256i)((__v32qi)__a - (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sub_epi16(__m256i a, __m256i b)
_mm256_sub_epi16(__m256i __a, __m256i __b)
{
return (__m256i)((__v16hi)a - (__v16hi)b);
return (__m256i)((__v16hi)__a - (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sub_epi32(__m256i a, __m256i b)
_mm256_sub_epi32(__m256i __a, __m256i __b)
{
return (__m256i)((__v8si)a - (__v8si)b);
return (__m256i)((__v8si)__a - (__v8si)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_sub_epi64(__m256i a, __m256i b)
_mm256_sub_epi64(__m256i __a, __m256i __b)
{
return a - b;
return __a - __b;
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_subs_epi8(__m256i a, __m256i b)
_mm256_subs_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psubsb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_psubsb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_subs_epi16(__m256i a, __m256i b)
_mm256_subs_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psubsw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_psubsw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_subs_epu8(__m256i a, __m256i b)
_mm256_subs_epu8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psubusb256((__v32qi)a, (__v32qi)b);
return (__m256i)__builtin_ia32_psubusb256((__v32qi)__a, (__v32qi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_subs_epu16(__m256i a, __m256i b)
_mm256_subs_epu16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_psubusw256((__v16hi)a, (__v16hi)b);
return (__m256i)__builtin_ia32_psubusw256((__v16hi)__a, (__v16hi)__b);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpackhi_epi8(__m256i a, __m256i b)
_mm256_unpackhi_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector((__v32qi)a, (__v32qi)b, 8, 32+8, 9, 32+9, 10, 32+10, 11, 32+11, 12, 32+12, 13, 32+13, 14, 32+14, 15, 32+15, 24, 32+24, 25, 32+25, 26, 32+26, 27, 32+27, 28, 32+28, 29, 32+29, 30, 32+30, 31, 32+31);
return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 8, 32+8, 9, 32+9, 10, 32+10, 11, 32+11, 12, 32+12, 13, 32+13, 14, 32+14, 15, 32+15, 24, 32+24, 25, 32+25, 26, 32+26, 27, 32+27, 28, 32+28, 29, 32+29, 30, 32+30, 31, 32+31);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpackhi_epi16(__m256i a, __m256i b)
_mm256_unpackhi_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector((__v16hi)a, (__v16hi)b, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpackhi_epi32(__m256i a, __m256i b)
_mm256_unpackhi_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector((__v8si)a, (__v8si)b, 2, 8+2, 3, 8+3, 6, 8+6, 7, 8+7);
return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 2, 8+2, 3, 8+3, 6, 8+6, 7, 8+7);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpackhi_epi64(__m256i a, __m256i b)
_mm256_unpackhi_epi64(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector(a, b, 1, 4+1, 3, 4+3);
return (__m256i)__builtin_shufflevector(__a, __b, 1, 4+1, 3, 4+3);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpacklo_epi8(__m256i a, __m256i b)
_mm256_unpacklo_epi8(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector((__v32qi)a, (__v32qi)b, 0, 32+0, 1, 32+1, 2, 32+2, 3, 32+3, 4, 32+4, 5, 32+5, 6, 32+6, 7, 32+7, 16, 32+16, 17, 32+17, 18, 32+18, 19, 32+19, 20, 32+20, 21, 32+21, 22, 32+22, 23, 32+23);
return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 0, 32+0, 1, 32+1, 2, 32+2, 3, 32+3, 4, 32+4, 5, 32+5, 6, 32+6, 7, 32+7, 16, 32+16, 17, 32+17, 18, 32+18, 19, 32+19, 20, 32+20, 21, 32+21, 22, 32+22, 23, 32+23);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpacklo_epi16(__m256i a, __m256i b)
_mm256_unpacklo_epi16(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector((__v16hi)a, (__v16hi)b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11);
return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpacklo_epi32(__m256i a, __m256i b)
_mm256_unpacklo_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector((__v8si)a, (__v8si)b, 0, 8+0, 1, 8+1, 4, 8+4, 5, 8+5);
return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 0, 8+0, 1, 8+1, 4, 8+4, 5, 8+5);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_unpacklo_epi64(__m256i a, __m256i b)
_mm256_unpacklo_epi64(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_shufflevector(a, b, 0, 4+0, 2, 4+2);
return (__m256i)__builtin_shufflevector(__a, __b, 0, 4+0, 2, 4+2);
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_xor_si256(__m256i a, __m256i b)
_mm256_xor_si256(__m256i __a, __m256i __b)
{
return a ^ b;
return __a ^ __b;
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
@ -750,9 +750,9 @@ _mm256_broadcastsd_pd(__m128d __X)
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm_broadcastsi128_si256(__m128i const *a)
_mm_broadcastsi128_si256(__m128i const *__a)
{
return (__m256i)__builtin_ia32_vbroadcastsi256(a);
return (__m256i)__builtin_ia32_vbroadcastsi256(__a);
}
#define _mm_blend_epi32(V1, V2, M) __extension__ ({ \
@ -815,9 +815,9 @@ _mm_broadcastq_epi64(__m128i __X)
}
static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
_mm256_permutevar8x32_epi32(__m256i a, __m256i b)
_mm256_permutevar8x32_epi32(__m256i __a, __m256i __b)
{
return (__m256i)__builtin_ia32_permvarsi256((__v8si)a, (__v8si)b);
return (__m256i)__builtin_ia32_permvarsi256((__v8si)__a, (__v8si)__b);
}
#define _mm256_permute4x64_pd(V, M) __extension__ ({ \
@ -827,9 +827,9 @@ _mm256_permutevar8x32_epi32(__m256i a, __m256i b)
((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
_mm256_permutevar8x32_ps(__m256 a, __m256 b)
_mm256_permutevar8x32_ps(__m256 __a, __m256 __b)
{
return (__m256)__builtin_ia32_permvarsf256((__v8sf)a, (__v8sf)b);
return (__m256)__builtin_ia32_permvarsf256((__v8sf)__a, (__v8sf)__b);
}
#define _mm256_permute4x64_epi64(V, M) __extension__ ({ \

File diff suppressed because it is too large Load Diff

View File

@ -25,9 +25,10 @@
#error this header is for x86 only
#endif
static inline int __get_cpuid (unsigned int level, unsigned int *eax,
unsigned int *ebx, unsigned int *ecx,
unsigned int *edx) {
__asm("cpuid" : "=a"(*eax), "=b" (*ebx), "=c"(*ecx), "=d"(*edx) : "0"(level));
static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax,
unsigned int *__ebx, unsigned int *__ecx,
unsigned int *__edx) {
__asm("cpuid" : "=a"(*__eax), "=b" (*__ebx), "=c"(*__ecx), "=d"(*__edx)
: "0"(__level));
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/*===---- f16cintrin.h - F16C intrinsics ---------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* Permission is hereby granted, free of charge, to any person obtaining __a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@ -44,15 +44,15 @@ typedef float __m256 __attribute__ ((__vector_size__ (32)));
(__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (imm)); })
static __inline __m128 __attribute__((__always_inline__, __nodebug__))
_mm_cvtph_ps(__m128i a)
_mm_cvtph_ps(__m128i __a)
{
return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)a);
return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a);
}
static __inline __m256 __attribute__((__always_inline__, __nodebug__))
_mm256_cvtph_ps(__m128i a)
_mm256_cvtph_ps(__m128i __a)
{
return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)a);
return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
}
#endif /* __F16CINTRIN_H */

View File

@ -102,4 +102,13 @@ _rdrand64_step(unsigned long long *__p)
#include <rtmintrin.h>
#endif
/* FIXME: check __HLE__ as well when HLE is supported. */
#if defined (__RTM__)
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_xtest(void)
{
return __builtin_ia32_xtest();
}
#endif
#endif /* __IMMINTRIN_H */

View File

@ -25,6 +25,7 @@
#define _MM3DNOW_H_INCLUDED
#include <mmintrin.h>
#include <prfchwintrin.h>
typedef float __v2sf __attribute__((__vector_size__(8)));

View File

@ -30,45 +30,45 @@
#include <malloc.h>
#else
#ifndef __cplusplus
extern int posix_memalign(void **memptr, size_t alignment, size_t size);
extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
#else
// Some systems (e.g. those with GNU libc) declare posix_memalign with an
// exception specifier. Via an "egregious workaround" in
// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
// redeclaration of glibc's declaration.
extern "C" int posix_memalign(void **memptr, size_t alignment, size_t size);
extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
#endif
#endif
#if !(defined(_WIN32) && defined(_mm_malloc))
static __inline__ void *__attribute__((__always_inline__, __nodebug__,
__malloc__))
_mm_malloc(size_t size, size_t align)
_mm_malloc(size_t __size, size_t __align)
{
if (align == 1) {
return malloc(size);
if (__align == 1) {
return malloc(__size);
}
if (!(align & (align - 1)) && align < sizeof(void *))
align = sizeof(void *);
if (!(__align & (__align - 1)) && __align < sizeof(void *))
__align = sizeof(void *);
void *mallocedMemory;
void *__mallocedMemory;
#if defined(__MINGW32__)
mallocedMemory = __mingw_aligned_malloc(size, align);
__mallocedMemory = __mingw_aligned_malloc(__size, __align);
#elif defined(_WIN32)
mallocedMemory = _aligned_malloc(size, align);
__mallocedMemory = _aligned_malloc(__size, __align);
#else
if (posix_memalign(&mallocedMemory, align, size))
if (posix_memalign(&__mallocedMemory, __align, __size))
return 0;
#endif
return mallocedMemory;
return __mallocedMemory;
}
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_mm_free(void *p)
_mm_free(void *__p)
{
free(p);
free(__p);
}
#endif

View File

@ -17,6 +17,7 @@ module _Builtin_intrinsics [system] {
}
explicit module cpuid {
requires x86
header "cpuid.h"
}
@ -33,7 +34,6 @@ module _Builtin_intrinsics [system] {
explicit module sse {
requires sse
export mmx
export * // note: for hackish <emmintrin.h> dependency
header "xmmintrin.h"
}

View File

@ -31,65 +31,65 @@
#include <emmintrin.h>
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_lddqu_si128(__m128i const *p)
_mm_lddqu_si128(__m128i const *__p)
{
return (__m128i)__builtin_ia32_lddqu((char const *)p);
return (__m128i)__builtin_ia32_lddqu((char const *)__p);
}
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
_mm_addsub_ps(__m128 a, __m128 b)
_mm_addsub_ps(__m128 __a, __m128 __b)
{
return __builtin_ia32_addsubps(a, b);
return __builtin_ia32_addsubps(__a, __b);
}
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
_mm_hadd_ps(__m128 a, __m128 b)
_mm_hadd_ps(__m128 __a, __m128 __b)
{
return __builtin_ia32_haddps(a, b);
return __builtin_ia32_haddps(__a, __b);
}
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
_mm_hsub_ps(__m128 a, __m128 b)
_mm_hsub_ps(__m128 __a, __m128 __b)
{
return __builtin_ia32_hsubps(a, b);
return __builtin_ia32_hsubps(__a, __b);
}
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
_mm_movehdup_ps(__m128 a)
_mm_movehdup_ps(__m128 __a)
{
return __builtin_shufflevector(a, a, 1, 1, 3, 3);
return __builtin_shufflevector(__a, __a, 1, 1, 3, 3);
}
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
_mm_moveldup_ps(__m128 a)
_mm_moveldup_ps(__m128 __a)
{
return __builtin_shufflevector(a, a, 0, 0, 2, 2);
return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
}
static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
_mm_addsub_pd(__m128d a, __m128d b)
_mm_addsub_pd(__m128d __a, __m128d __b)
{
return __builtin_ia32_addsubpd(a, b);
return __builtin_ia32_addsubpd(__a, __b);
}
static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
_mm_hadd_pd(__m128d a, __m128d b)
_mm_hadd_pd(__m128d __a, __m128d __b)
{
return __builtin_ia32_haddpd(a, b);
return __builtin_ia32_haddpd(__a, __b);
}
static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
_mm_hsub_pd(__m128d a, __m128d b)
_mm_hsub_pd(__m128d __a, __m128d __b)
{
return __builtin_ia32_hsubpd(a, b);
return __builtin_ia32_hsubpd(__a, __b);
}
#define _mm_loaddup_pd(dp) _mm_load1_pd(dp)
static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
_mm_movedup_pd(__m128d a)
_mm_movedup_pd(__m128d __a)
{
return __builtin_shufflevector(a, a, 0, 0);
return __builtin_shufflevector(__a, __a, 0, 0);
}
#define _MM_DENORMALS_ZERO_ON (0x0040)
@ -101,15 +101,15 @@ _mm_movedup_pd(__m128d a)
#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_mm_monitor(void const *p, unsigned extensions, unsigned hints)
_mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
{
__builtin_ia32_monitor((void *)p, extensions, hints);
__builtin_ia32_monitor((void *)__p, __extensions, __hints);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_mm_mwait(unsigned extensions, unsigned hints)
_mm_mwait(unsigned __extensions, unsigned __hints)
{
__builtin_ia32_mwait(extensions, hints);
__builtin_ia32_mwait(__extensions, __hints);
}
#endif /* __SSE3__ */

View File

@ -0,0 +1,34 @@
/*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined(__X86INTRIN_H) && !defined(_MM3DNOW_H_INCLUDED)
#error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead."
#endif
#if defined(__PRFCHW__) || defined(__3dNOW__)
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetchw(void *__P)
{
__builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
}
#endif

View File

@ -0,0 +1,48 @@
/*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __X86INTRIN_H
#error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifdef __RDSEED__
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_rdseed16_step(unsigned short *__p)
{
return __builtin_ia32_rdseed16_step(__p);
}
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_rdseed32_step(unsigned int *__p)
{
return __builtin_ia32_rdseed32_step(__p);
}
#ifdef __x86_64__
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_rdseed64_step(unsigned long long *__p)
{
return __builtin_ia32_rdseed64_step(__p);
}
#endif
#endif /* __RDSEED__ */

View File

@ -195,10 +195,10 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2)
/* SSE4 Insertion and Extraction from XMM Register Instructions. */
#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))
#define _mm_extract_ps(X, N) (__extension__ \
({ union { int i; float f; } __t; \
({ union { int __i; float __f; } __t; \
__v4sf __a = (__v4sf)(X); \
__t.f = __a[N]; \
__t.i;}))
__t.__f = __a[N]; \
__t.__i;}))
/* Miscellaneous insert and extract macros. */
/* Extract a single-precision float from X at index N into D. */

View File

@ -24,7 +24,12 @@
#ifndef __STDALIGN_H
#define __STDALIGN_H
#ifndef __cplusplus
#define alignas _Alignas
#define alignof _Alignof
#endif
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#endif /* __STDALIGN_H */

View File

@ -26,17 +26,42 @@
#ifndef __STDDEF_H
#define __STDDEF_H
#ifndef _PTRDIFF_T
#if !defined(_PTRDIFF_T) || __has_feature(modules)
/* Always define ptrdiff_t when modules are available. */
#if !__has_feature(modules)
#define _PTRDIFF_T
typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
#endif
#ifndef _SIZE_T
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#endif
#if !defined(_SIZE_T) || __has_feature(modules)
/* Always define size_t when modules are available. */
#if !__has_feature(modules)
#define _SIZE_T
typedef __typeof__(sizeof(int)) size_t;
#endif
typedef __SIZE_TYPE__ size_t;
#endif
/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
* enabled. */
#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
!defined(_RSIZE_T)) || __has_feature(modules)
/* Always define rsize_t when modules are available. */
#if !__has_feature(modules)
#define _RSIZE_T
#endif
typedef __SIZE_TYPE__ rsize_t;
#endif
#ifndef __cplusplus
#ifndef _WCHAR_T
/* Always define wchar_t when modules are available. */
#if !defined(_WCHAR_T) || __has_feature(modules)
#if !__has_feature(modules)
#define _WCHAR_T
#if defined(_MSC_EXTENSIONS)
#define _WCHAR_T_DEFINED
#endif
#endif
typedef __WCHAR_TYPE__ wchar_t;
#endif
#endif
@ -66,9 +91,12 @@ using ::std::nullptr_t;
/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
#if defined(__need_wint_t)
#if !defined(_WINT_T)
/* Always define wint_t when modules are available. */
#if !defined(_WINT_T) || __has_feature(modules)
#if !__has_feature(modules)
#define _WINT_T
#endif
typedef __WINT_TYPE__ wint_t;
#endif /* _WINT_T */
#endif
#undef __need_wint_t
#endif /* __need_wint_t */

View File

@ -30,7 +30,48 @@
*/
#if __STDC_HOSTED__ && \
defined(__has_include_next) && __has_include_next(<stdint.h>)
// C99 7.18.3 Limits of other integer types
//
// Footnote 219, 220: C++ implementations should define these macros only when
// __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
//
// Footnote 222: C++ implementations should define these macros only when
// __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
//
// C++11 [cstdint.syn]p2:
//
// The macros defined by <cstdint> are provided unconditionally. In particular,
// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
// footnotes 219, 220, and 222 in the C standard) play no role in C++.
//
// C11 removed the problematic footnotes.
//
// Work around this inconsistency by always defining those macros in C++ mode,
// so that a C library implementation which follows the C99 standard can be
// used in C++.
# ifdef __cplusplus
# if !defined(__STDC_LIMIT_MACROS)
# define __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
# endif
# if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
# endif
# endif
# include_next <stdint.h>
# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
# undef __STDC_LIMIT_MACROS
# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
# endif
# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
# undef __STDC_CONSTANT_MACROS
# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
# endif
#else
/* C99 7.18.1.1 Exact-width integer types.
@ -626,6 +667,12 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__)
#define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
* is enabled. */
#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
#define RSIZE_MAX (SIZE_MAX >> 1)
#endif
/* C99 7.18.2.5 Limits of greatest-width integer types. */
#define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__)
#define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__)

View File

@ -0,0 +1,30 @@
/*===---- stdnoreturn.h - Standard header for noreturn macro ---------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __STDNORETURN_H
#define __STDNORETURN_H
#define noreturn _Noreturn
#define __noreturn_is_defined 1
#endif /* __STDNORETURN_H */

View File

@ -31,39 +31,39 @@
#include <pmmintrin.h>
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_abs_pi8(__m64 a)
_mm_abs_pi8(__m64 __a)
{
return (__m64)__builtin_ia32_pabsb((__v8qi)a);
return (__m64)__builtin_ia32_pabsb((__v8qi)__a);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_abs_epi8(__m128i a)
_mm_abs_epi8(__m128i __a)
{
return (__m128i)__builtin_ia32_pabsb128((__v16qi)a);
return (__m128i)__builtin_ia32_pabsb128((__v16qi)__a);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_abs_pi16(__m64 a)
_mm_abs_pi16(__m64 __a)
{
return (__m64)__builtin_ia32_pabsw((__v4hi)a);
return (__m64)__builtin_ia32_pabsw((__v4hi)__a);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_abs_epi16(__m128i a)
_mm_abs_epi16(__m128i __a)
{
return (__m128i)__builtin_ia32_pabsw128((__v8hi)a);
return (__m128i)__builtin_ia32_pabsw128((__v8hi)__a);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_abs_pi32(__m64 a)
_mm_abs_pi32(__m64 __a)
{
return (__m64)__builtin_ia32_pabsd((__v2si)a);
return (__m64)__builtin_ia32_pabsd((__v2si)__a);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_abs_epi32(__m128i a)
_mm_abs_epi32(__m128i __a)
{
return (__m128i)__builtin_ia32_pabsd128((__v4si)a);
return (__m128i)__builtin_ia32_pabsd128((__v4si)__a);
}
#define _mm_alignr_epi8(a, b, n) __extension__ ({ \
@ -77,147 +77,147 @@ _mm_abs_epi32(__m128i a)
(__m64)__builtin_ia32_palignr((__v8qi)__a, (__v8qi)__b, (n)); })
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_hadd_epi16(__m128i a, __m128i b)
_mm_hadd_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_phaddw128((__v8hi)a, (__v8hi)b);
return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_hadd_epi32(__m128i a, __m128i b)
_mm_hadd_epi32(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_phaddd128((__v4si)a, (__v4si)b);
return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_hadd_pi16(__m64 a, __m64 b)
_mm_hadd_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_phaddw((__v4hi)a, (__v4hi)b);
return (__m64)__builtin_ia32_phaddw((__v4hi)__a, (__v4hi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_hadd_pi32(__m64 a, __m64 b)
_mm_hadd_pi32(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_phaddd((__v2si)a, (__v2si)b);
return (__m64)__builtin_ia32_phaddd((__v2si)__a, (__v2si)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_hadds_epi16(__m128i a, __m128i b)
_mm_hadds_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_phaddsw128((__v8hi)a, (__v8hi)b);
return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_hadds_pi16(__m64 a, __m64 b)
_mm_hadds_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_phaddsw((__v4hi)a, (__v4hi)b);
return (__m64)__builtin_ia32_phaddsw((__v4hi)__a, (__v4hi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_hsub_epi16(__m128i a, __m128i b)
_mm_hsub_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_phsubw128((__v8hi)a, (__v8hi)b);
return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_hsub_epi32(__m128i a, __m128i b)
_mm_hsub_epi32(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_phsubd128((__v4si)a, (__v4si)b);
return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_hsub_pi16(__m64 a, __m64 b)
_mm_hsub_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_phsubw((__v4hi)a, (__v4hi)b);
return (__m64)__builtin_ia32_phsubw((__v4hi)__a, (__v4hi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_hsub_pi32(__m64 a, __m64 b)
_mm_hsub_pi32(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_phsubd((__v2si)a, (__v2si)b);
return (__m64)__builtin_ia32_phsubd((__v2si)__a, (__v2si)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_hsubs_epi16(__m128i a, __m128i b)
_mm_hsubs_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_phsubsw128((__v8hi)a, (__v8hi)b);
return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_hsubs_pi16(__m64 a, __m64 b)
_mm_hsubs_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_phsubsw((__v4hi)a, (__v4hi)b);
return (__m64)__builtin_ia32_phsubsw((__v4hi)__a, (__v4hi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_maddubs_epi16(__m128i a, __m128i b)
_mm_maddubs_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)a, (__v16qi)b);
return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_maddubs_pi16(__m64 a, __m64 b)
_mm_maddubs_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_pmaddubsw((__v8qi)a, (__v8qi)b);
return (__m64)__builtin_ia32_pmaddubsw((__v8qi)__a, (__v8qi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_mulhrs_epi16(__m128i a, __m128i b)
_mm_mulhrs_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)a, (__v8hi)b);
return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_mulhrs_pi16(__m64 a, __m64 b)
_mm_mulhrs_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_pmulhrsw((__v4hi)a, (__v4hi)b);
return (__m64)__builtin_ia32_pmulhrsw((__v4hi)__a, (__v4hi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_shuffle_epi8(__m128i a, __m128i b)
_mm_shuffle_epi8(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_pshufb128((__v16qi)a, (__v16qi)b);
return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_shuffle_pi8(__m64 a, __m64 b)
_mm_shuffle_pi8(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_pshufb((__v8qi)a, (__v8qi)b);
return (__m64)__builtin_ia32_pshufb((__v8qi)__a, (__v8qi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sign_epi8(__m128i a, __m128i b)
_mm_sign_epi8(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_psignb128((__v16qi)a, (__v16qi)b);
return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sign_epi16(__m128i a, __m128i b)
_mm_sign_epi16(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_psignw128((__v8hi)a, (__v8hi)b);
return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sign_epi32(__m128i a, __m128i b)
_mm_sign_epi32(__m128i __a, __m128i __b)
{
return (__m128i)__builtin_ia32_psignd128((__v4si)a, (__v4si)b);
return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_sign_pi8(__m64 a, __m64 b)
_mm_sign_pi8(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_psignb((__v8qi)a, (__v8qi)b);
return (__m64)__builtin_ia32_psignb((__v8qi)__a, (__v8qi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_sign_pi16(__m64 a, __m64 b)
_mm_sign_pi16(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_psignw((__v4hi)a, (__v4hi)b);
return (__m64)__builtin_ia32_psignw((__v4hi)__a, (__v4hi)__b);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_sign_pi32(__m64 a, __m64 b)
_mm_sign_pi32(__m64 __a, __m64 __b)
{
return (__m64)__builtin_ia32_psignd((__v2si)a, (__v2si)b);
return (__m64)__builtin_ia32_psignd((__v2si)__a, (__v2si)__b);
}
#endif /* __SSSE3__ */

View File

@ -23,6 +23,9 @@
/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
#ifndef __CLANG_UNWIND_H
#define __CLANG_UNWIND_H
#if __has_include_next(<unwind.h>)
/* Darwin and libunwind provide an unwind.h. If that's available, use
* it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
@ -59,7 +62,9 @@ extern "C" {
/* It is a bit strange for a header to play with the visibility of the
symbols it declares, but this matches gcc's behavior and some programs
depend on it */
#ifndef HIDE_EXPORTS
#pragma GCC visibility push(default)
#endif
struct _Unwind_Context;
typedef enum {
@ -100,25 +105,29 @@ typedef enum {
_UVRSR_FAILED = 2
} _Unwind_VRS_Result;
_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *context,
_Unwind_VRS_RegClass regclass,
uint32_t regno,
_Unwind_VRS_DataRepresentation representation,
void *valuep);
_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context,
_Unwind_VRS_RegClass __regclass,
uint32_t __regno,
_Unwind_VRS_DataRepresentation __representation,
void *__valuep);
#else
uintptr_t _Unwind_GetIP(struct _Unwind_Context* context);
uintptr_t _Unwind_GetIP(struct _Unwind_Context* __context);
#endif
typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context*, void*);
_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void*);
#ifndef HIDE_EXPORTS
#pragma GCC visibility pop
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif /* __CLANG_UNWIND_H */

View File

@ -46,6 +46,14 @@
#include <popcntintrin.h>
#endif
#ifdef __RDSEED__
#include <rdseedintrin.h>
#endif
#ifdef __PRFCHW__
#include <prfchwintrin.h>
#endif
#ifdef __SSE4A__
#include <ammintrin.h>
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*===---- xopintrin.h - FMA4 intrinsics ------------------------------------===
/*===---- xopintrin.h - XOP intrinsics -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
*/
#ifndef __X86INTRIN_H
#error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead."
#error "Never use <xopintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __XOPINTRIN_H

View File

@ -18,6 +18,7 @@
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import vim
from ycm import vimsupport
from ycm import utils
@ -29,7 +30,8 @@ except ImportError as e:
'Error importing ycm_core. Are you sure you have placed a version 3.2+ '
'libclang.[so|dll|dylib] in folder "{0}"? See the Installation Guide in '
'the docs. Full error: {1}'.format(
os.path.dirname( os.path.abspath( __file__ ) ), str( e ) ) )
os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) ),
str( e ) ) )
def CompletionStartColumn():
@ -70,6 +72,55 @@ def CurrentIdentifierFinished():
return line[ : current_column ].isspace()
def AdjustCandidateInsertionText( candidates ):
"""This function adjusts the candidate insertion text to take into account the
text that's currently in front of the cursor.
For instance ('|' represents the cursor):
1. Buffer state: 'foo.|bar'
2. A completion candidate of 'zoobar' is shown and the user selects it.
3. Buffer state: 'foo.zoobar|bar' instead of 'foo.zoo|bar' which is what the
user wanted.
This function changes candidates to resolve that issue.
It could be argued that the user actually wants the final buffer state to be
'foo.zoobar|' (the cursor at the end), but that would be much more difficult
to implement and is probably not worth doing.
"""
def NewCandidateInsertionText( to_insert, word_after_cursor ):
if to_insert.endswith( word_after_cursor ):
return to_insert[ : - len( word_after_cursor ) ]
return to_insert
match = re.search( r'^(\w+)', vimsupport.TextAfterCursor() )
if not match:
return candidates
new_candidates = []
word_after_cursor = match.group( 1 )
for candidate in candidates:
if type( candidate ) is dict:
new_candidate = candidate.copy()
if not 'abbr' in new_candidate:
new_candidate[ 'abbr' ] = new_candidate[ 'word' ]
new_candidate[ 'word' ] = NewCandidateInsertionText(
new_candidate[ 'word' ],
word_after_cursor )
new_candidates.append( new_candidate )
elif type( candidate ) is str:
new_candidates.append(
{ 'abbr': candidate,
'word': NewCandidateInsertionText( candidate, word_after_cursor ) } )
return new_candidates
COMPATIBLE_WITH_CORE_VERSION = 4
def CompatibleWithYcmCore():

View File

@ -27,8 +27,10 @@ from ycm import vimsupport
from ycm import utils
MAX_IDENTIFIER_COMPLETIONS_RETURNED = 10
MIN_NUM_CHARS = int( vimsupport.GetVariableValue(
MIN_NUM_COMPLETION_START_CHARS = int( vimsupport.GetVariableValue(
"g:ycm_min_num_of_chars_for_completion" ) )
MIN_NUM_CANDIDATE_SIZE_CHARS = int( vimsupport.GetVariableValue(
"g:ycm_min_num_identifier_candidate_chars" ) )
SYNTAX_FILENAME = 'YCM_PLACEHOLDER_FOR_SYNTAX'
@ -172,6 +174,8 @@ class IdentifierCompleter( GeneralCompleter ):
completions = self.completions_future.GetResults()[
: MAX_IDENTIFIER_COMPLETIONS_RETURNED ]
completions = _RemoveSmallCandidates( completions )
# We will never have duplicates in completions so with 'dup':1 we tell Vim
# to add this candidate even if it's a duplicate of an existing one (which
# will never happen). This saves us some expensive string matching
@ -204,8 +208,15 @@ def PreviousIdentifier():
while start_column > 0 and utils.IsIdentifierChar( line[ start_column - 1 ] ):
start_column -= 1
if end_column - start_column < MIN_NUM_CHARS:
if end_column - start_column < MIN_NUM_COMPLETION_START_CHARS:
return ""
return line[ start_column : end_column ]
def _RemoveSmallCandidates( candidates ):
if MIN_NUM_CANDIDATE_SIZE_CHARS == 0:
return candidates
return [ x for x in candidates if len( x ) >= MIN_NUM_CANDIDATE_SIZE_CHARS ]

View File

@ -45,6 +45,7 @@ class OmniCompleter( Completer ):
return super( OmniCompleter, self ).ShouldUseNow( start_column )
return self.ShouldUseNowInner( start_column )
def ShouldUseNowInner( self, start_column ):
if not self.omnifunc:
return False
@ -58,6 +59,7 @@ class OmniCompleter( Completer ):
else:
return self.CandidatesForQueryAsyncInner( query, unused_start_column )
def CandidatesForQueryAsyncInner( self, query, unused_start_column ):
if not self.omnifunc:
self.stored_candidates = None
@ -104,6 +106,7 @@ class OmniCompleter( Completer ):
else:
return self.CandidatesFromStoredRequestInner()
def CandidatesFromStoredRequestInner( self ):
return self.stored_candidates if self.stored_candidates else []

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>
# Copyright (C) 2011, 2012, 2013 Strahinja Val Markovic <val@markovic.io>
#
# This file is part of YouCompleteMe.
#
@ -21,7 +21,7 @@ import abc
import vim
import ycm_core
from ycm import vimsupport
from collections import defaultdict
from ycm.completers.completer_utils import TriggersForFiletype
NO_USER_COMMANDS = 'This completer does not define any commands.'
@ -278,6 +278,10 @@ class Completer( object ):
pass
def OnVimLeave( self ):
pass
def OnUserCommand( self, arguments ):
vimsupport.PostVimMessage( NO_USER_COMMANDS )
@ -336,14 +340,3 @@ class CompletionsCache( object ):
return completion_line == self.line and completion_column == self.column
def TriggersForFiletype():
triggers = vim.eval( 'g:ycm_semantic_triggers' )
triggers_for_filetype = defaultdict( list )
for key, value in triggers.iteritems():
filetypes = key.split( ',' )
for filetype in filetypes:
triggers_for_filetype[ filetype ].extend( value )
return triggers_for_filetype

View File

@ -0,0 +1,69 @@
#!/usr/bin/env python
#
# Copyright (C) 2013 Strahinja Val Markovic <val@markovic.io>
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YouCompleteMe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
from collections import defaultdict
from copy import deepcopy
import vim
DEFAULT_FILETYPE_TRIGGERS = {
'c' : ['->', '.'],
'objc' : ['->', '.'],
'ocaml' : ['.', '#'],
'cpp,objcpp' : ['->', '.', '::'],
'perl' : ['->'],
'php' : ['->', '::'],
'cs,java,javascript,d,vim,python,perl6,scala,vb,elixir,go' : ['.'],
'ruby' : ['.', '::'],
'lua' : ['.', ':'],
'erlang' : [':'],
}
def _FiletypeTriggerDictFromSpec( trigger_dict_spec ):
triggers_for_filetype = defaultdict( set )
for key, value in trigger_dict_spec.iteritems():
filetypes = key.split( ',' )
for filetype in filetypes:
triggers_for_filetype[ filetype ].update( value )
return triggers_for_filetype
def _FiletypeDictUnion( dict_one, dict_two ):
"""Returns a new filetye dict that's a union of the provided two dicts.
Dict params are supposed to be type defaultdict(set)."""
final_dict = deepcopy( dict_one )
for key, value in dict_two.iteritems():
final_dict[ key ].update( value )
return final_dict
def TriggersForFiletype():
user_triggers = _FiletypeTriggerDictFromSpec(
vim.eval( 'g:ycm_semantic_triggers' ) )
default_triggers = _FiletypeTriggerDictFromSpec(
DEFAULT_FILETYPE_TRIGGERS )
return _FiletypeDictUnion( default_triggers, user_triggers )

View File

@ -0,0 +1,58 @@
#!/usr/bin/env python
#
# Copyright (C) 2013 Strahinja Val Markovic <val@markovic.io>
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YouCompleteMe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
from collections import defaultdict
from nose.tools import eq_
from ycm.test_utils import MockVimModule
vim_mock = MockVimModule()
from ycm.completers import completer_utils
def FiletypeTriggerDictFromSpec_Works_test():
eq_( defaultdict( set, {
'foo': set(['zoo', 'bar']),
'goo': set(['moo']),
'moo': set(['moo']),
'qux': set(['q'])
} ),
completer_utils._FiletypeTriggerDictFromSpec( {
'foo': ['zoo', 'bar'],
'goo,moo': ['moo'],
'qux': ['q']
} ) )
def FiletypeDictUnion_Works_test():
eq_( defaultdict( set, {
'foo': set(['zoo', 'bar', 'maa']),
'goo': set(['moo']),
'bla': set(['boo']),
'qux': set(['q'])
} ),
completer_utils._FiletypeDictUnion( defaultdict( set, {
'foo': set(['zoo', 'bar']),
'goo': set(['moo']),
'qux': set(['q'])
} ), defaultdict( set, {
'foo': set(['maa']),
'bla': set(['boo']),
'qux': set(['q'])
} ) ) )

View File

@ -23,8 +23,9 @@ from ycm import vimsupport
from ycm import extra_conf_store
NO_EXTRA_CONF_FILENAME_MESSAGE = ('No {0} file detected, so no compile flags '
'are available. Thus no semantic support for C/C++/ObjC/ObjC++. See the '
'docs for details.').format( extra_conf_store.YCM_EXTRA_CONF_FILENAME )
'are available. Thus no semantic support for C/C++/ObjC/ObjC++. Go READ THE '
'DOCS *NOW*, DON\'T file a bug report.').format(
extra_conf_store.YCM_EXTRA_CONF_FILENAME )
class Flags( object ):

View File

@ -130,6 +130,11 @@ class GeneralCompleterStore( Completer ):
completer.OnInsertLeave()
def OnVimLeave( self ):
for completer in self._all_completers:
completer.OnVimLeave()
def OnCurrentIdentifierFinished( self ):
for completer in self._all_completers:
completer.OnCurrentIdentifierFinished()

View File

@ -67,10 +67,10 @@ class JediCompleter( ThreadedCompleter ):
def ComputeCandidates( self, unused_query, unused_start_column ):
script = self._GetJediScript()
return [ { 'word': str( completion.word ),
return [ { 'word': str( completion.name ),
'menu': str( completion.description ),
'info': str( completion.doc ) }
for completion in script.complete() ]
for completion in script.completions() ]
def DefinedSubcommands( self ):
@ -147,7 +147,7 @@ class JediCompleter( ThreadedCompleter ):
vimsupport.PostVimMessage( "Builtin modules cannot be displayed." )
else:
vimsupport.JumpToLocation( definition.module_path,
definition.line_nr,
definition.line,
definition.column + 1 )
else:
# multiple definitions
@ -158,7 +158,7 @@ class JediCompleter( ThreadedCompleter ):
definition.description.encode( 'utf-8' ) } )
else:
defs.append( {'filename': definition.module_path.encode( 'utf-8' ),
'lnum': definition.line_nr,
'lnum': definition.line,
'col': definition.column + 1,
'text': definition.description.encode( 'utf-8' ) } )

View File

@ -24,7 +24,13 @@ def MockVimModule():
"""The 'vim' module is something that is only present when running inside the
Vim Python interpreter, so we replace it with a MagicMock for tests. """
def VimEval( value ):
if value == "g:ycm_min_num_of_chars_for_completion":
return 0
return ''
vim_mock = MagicMock()
vim_mock.eval = MagicMock( return_value = '' )
vim_mock.eval = MagicMock( side_effect = VimEval )
sys.modules[ 'vim' ] = vim_mock
return vim_mock

View File

@ -0,0 +1,90 @@
#!/usr/bin/env python
#
# Copyright (C) 2013 Strahinja Val Markovic <val@markovic.io>
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YouCompleteMe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
from nose.tools import eq_
from mock import MagicMock
from ycm.test_utils import MockVimModule
vim_mock = MockVimModule()
from ycm import base
from ycm import vimsupport
def AdjustCandidateInsertionText_Basic_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar' )
eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
base.AdjustCandidateInsertionText( [ 'foobar' ] ) )
def AdjustCandidateInsertionText_ParenInTextAfterCursor_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar(zoo' )
eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
base.AdjustCandidateInsertionText( [ 'foobar' ] ) )
def AdjustCandidateInsertionText_PlusInTextAfterCursor_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar+zoo' )
eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
base.AdjustCandidateInsertionText( [ 'foobar' ] ) )
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar zoo' )
eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
base.AdjustCandidateInsertionText( [ 'foobar' ] ) )
def AdjustCandidateInsertionText_NotSuffix_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar' )
eq_( [ { 'abbr': 'foofoo', 'word': 'foofoo' } ],
base.AdjustCandidateInsertionText( [ 'foofoo' ] ) )
def AdjustCandidateInsertionText_NothingAfterCursor_test():
vimsupport.TextAfterCursor = MagicMock( return_value = '' )
eq_( [ 'foofoo',
'zobar' ],
base.AdjustCandidateInsertionText( [ 'foofoo',
'zobar' ] ) )
def AdjustCandidateInsertionText_MultipleStrings_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar' )
eq_( [ { 'abbr': 'foobar', 'word': 'foo' },
{ 'abbr': 'zobar', 'word': 'zo' },
{ 'abbr': 'qbar', 'word': 'q' },
{ 'abbr': 'bar', 'word': '' },
],
base.AdjustCandidateInsertionText( [ 'foobar',
'zobar',
'qbar',
'bar' ] ) )
def AdjustCandidateInsertionText_DictInput_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar' )
eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
base.AdjustCandidateInsertionText(
[ { 'word': 'foobar' } ] ) )
def AdjustCandidateInsertionText_DontTouchAbbr_test():
vimsupport.TextAfterCursor = MagicMock( return_value = 'bar' )
eq_( [ { 'abbr': '1234', 'word': 'foo' } ],
base.AdjustCandidateInsertionText(
[ { 'abbr': '1234', 'word': 'foobar' } ] ) )

View File

@ -30,8 +30,8 @@ def CurrentLineAndColumn():
def CurrentColumn():
"""Returns the 0-based current column. Do NOT access the CurrentColumn in
vim.current.line. It doesn't exist yet. Only the chars before the current
column exist in vim.current.line."""
vim.current.line. It doesn't exist yet when the cursor is at the end of the
line. Only the chars before the current column exist in vim.current.line."""
# vim's columns are 1-based while vim.current.line columns are 0-based
# ... but vim.current.window.cursor (which returns a (line, column) tuple)
@ -41,6 +41,11 @@ def CurrentColumn():
return vim.current.window.cursor[ 1 ]
def TextAfterCursor():
"""Returns the text after CurrentColumn."""
return vim.current.line[ CurrentColumn(): ]
def GetUnsavedBuffers():
def BufferModified( buffer_number ):
to_eval = 'getbufvar({0}, "&mod")'.format( buffer_number )

View File

@ -144,6 +144,13 @@ class YouCompleteMe( object ):
self.GetFiletypeCompleter().OnInsertLeave()
def OnVimLeave( self ):
self.gencomp.OnVimLeave()
if self.FiletypeCompletionUsable():
self.GetFiletypeCompleter().OnVimLeave()
def DiagnosticsForCurrentFileReady( self ):
if self.FiletypeCompletionUsable():
return self.GetFiletypeCompleter().DiagnosticsForCurrentFileReady()