pgsql: Apply auto-vectorization to the inner loop of div_var_fast().

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема pgsql: Apply auto-vectorization to the inner loop of div_var_fast().
Дата
Msg-id E1nOGdt-0007wP-Bh@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Apply auto-vectorization to the inner loop of div_var_fast().

This loop is basically the same as the inner loop of mul_var(), which
was auto-vectorized in commit 8870917623, but the compiler will only
consider auto-vectorizing the div_var_fast() loop if the assignment
target div[qi + i] is replaced by div_qi[i], where div_qi = &div[qi].

Additionally, since the compiler doesn't know that qdigit is
guaranteed to fit in a 16-bit NumericDigit, cast it to NumericDigit
before multiplying to make the resulting auto-vectorized code more
efficient (avoiding unnecessary multiplication of the high 16 bits).

While at it, per suggestion from Tom Lane, change var1digit in
mul_var() to be a NumericDigit rather than an int for the same
reason. This actually makes no difference with modern gcc, but it
might help other compilers generate more efficient assembly.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCVwsBi-ND-t82Cuuh1=8ee6jdOpzsmGN+CUZB6yjLg9jw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e3d41d08a17549fdc60a8b9450c0511c11d666d7

Modified Files
--------------
src/backend/utils/adt/numeric.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: pgsql: Convert src/interfaces/libpq/test to a tap test.
Следующее
От: Dean Rasheed
Дата:
Сообщение: pgsql: Simplify the inner loop of numeric division in div_var().