Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit56f2c7b

Browse files
committed
Support SSE2 intrinsics where available
SSE2 vector instructions are part of the spec for the 64-bit x86architecture. Until now we have relied on the compiler to autovectorizein some limited situations, but some useful coding idioms can only beexpressed explicitly via compiler intrinsics. To this end, add a headerthat defines USE_SSE2 where available. While x86-only for now, we canadd other architectures in the future. This will also be the intendedplace for helper functions that use vector operations.Reviewed by Nathan Bossart and Masahiko SawadaDiscussion:https://www.postgresql.org/message-id/CAFBsxsE2G_H_5Wbw%2BNOPm70-BK4xxKf86-mRzY%3DL2sLoQqM%2B-Q%40mail.gmail.com
1 parent1aa8dad commit56f2c7b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

‎src/include/port/simd.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* simd.h
4+
* Support for platform-specific vector operations.
5+
*
6+
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
7+
* Portions Copyright (c) 1994, Regents of the University of California
8+
*
9+
* src/include/port/simd.h
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefSIMD_H
14+
#defineSIMD_H
15+
16+
/*
17+
* SSE2 instructions are part of the spec for the 64-bit x86 ISA. We assume
18+
* that compilers targeting this architecture understand SSE2 intrinsics.
19+
*
20+
* We use emmintrin.h rather than the comprehensive header immintrin.h in
21+
* order to exclude extensions beyond SSE2. This is because MSVC, at least,
22+
* will allow the use of intrinsics that haven't been enabled at compile
23+
* time.
24+
*/
25+
#if (defined(__x86_64__)|| defined(_M_AMD64))
26+
#include<emmintrin.h>
27+
#defineUSE_SSE2
28+
#endif
29+
30+
#endif/* SIMD_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp