-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
283 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <eve/module/core.hpp> | ||
#include <iostream> | ||
#include <bit> | ||
|
||
|
||
using wide_it = eve::wide<std::uint16_t, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_it pi = {-14, 1, 3, 0}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pi = " << pi << '\n' | ||
<< "-> bit_reverse[pi>0](pi) = " << eve::bit_reverse[pi>0](pi) << '\n' | ||
<< "-> bit_reverse[pi>0](pi, 4) = " << eve::bit_reverse[pi>0](pi, 4)<< '\n' | ||
<< "-> bit_reverse[pi>0][pi>2](pi) = " << eve::bit_reverse[pi>0](pi)<< '\n' | ||
<< "-> bit_reverse[pi>0][pi > 2](pi, 4) = " << eve::bit_reverse[pi>0](pi, 4)<< '\n' | ||
; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <eve/module/core.hpp> | ||
#include <iostream> | ||
#include <bit> | ||
|
||
|
||
using wide_it = eve::wide<std::uint16_t, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_it pi = {-14, 1, 3, 0}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pi = " << pi << '\n' | ||
<< "-> bit_reverse[pi>0](pi) = " << eve::bit_reverse[pi>0](pi) << '\n' | ||
<< "-> bit_reverse[pi>0](pi, 4) = " << eve::bit_reverse[pi>0](pi, 4)<< '\n' | ||
<< "-> bit_reverse[pi>0](pi) = " << eve::bit_reverse[pi>0](pi)<< '\n' | ||
<< "-> bit_reverse[pi>0][pi > 2](pi, 4) = " << eve::bit_reverse[pi>0](pi, 4)<< '\n' | ||
; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <eve/module/core.hpp> | ||
#include <iostream> | ||
|
||
using wide_it = eve::wide<std::uint32_t, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_it pi = {257, 1, 3, 0}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pi = " << pi << '\n' | ||
<< "-> byte_reverse[pi<2](pi) = " << eve::byte_reverse[pi<2](pi) << '\n'; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
using wide_ft = eve::wide<float, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_ft pf = {4.0f, 1.0f, -1.0f, -0.0f}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pf = " << pf << '\n' | ||
<< "-> is_unit[pf < 3](pf) = " << eve::is_unit[pf < 3](pf) << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
using wide_it = eve::wide<int16_t, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_it pf = {0, 1, -1, -eve::valmax(eve::as<int16_t>())}; | ||
wide_it qf = {1, -1, 0, eve::valmax(eve::as<int16_t>())}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pf = " << pf << '\n' | ||
<< "<- qf = " << qf << '\n' | ||
<< "-> dot(pf, qf) = " << eve::dot(pf, qf) << '\n'; | ||
|
||
int16_t xf = -eve::valmax(eve::as<int16_t>()); | ||
int16_t yf = eve::valmax(eve::as<int16_t>()); | ||
|
||
std::cout << "---- scalar" << '\n' | ||
<< "<- xf = " << xf << '\n' | ||
<< "<- yf = " << yf << '\n' | ||
<< "-> dot(xf, yf) = " << eve::dot(xf, yf) << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
using wide_ft = eve::wide<float, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_ft pf = {0.0f, 1.0f, -1.0f, -0.0f}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pf = " << pf << '\n' | ||
<< "-> is_unit(pf) = " << eve::is_unit(pf) << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
using wf_t = eve::wide<float, eve::fixed<4>>; | ||
wf_t pf = {6, 2.5, -320.7, 1.0}, qf = {4.2, 1.5, -100.834, eve::eps(eve::as<float>())/2}; | ||
auto [s, eps] = eve::quick_two_add(pf, qf); | ||
std::cout << "---- simd" << '\n' | ||
<< " <- pf = " << pf << '\n' | ||
<< " <- qf = " << qf << '\n' | ||
<< " -> {s, eps] = quick_two_add(pf, qf)\n" | ||
<< " -> s = " << s << '\n' | ||
<< " -> eps = " << eps << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
using wf_t = eve::wide<float, eve::fixed<4>>; | ||
wf_t pf = {6, 2.5, -320.7, 1.0}, qf = {4.2, 1.5, -100.834, eve::eps(eve::as<float>())/2}; | ||
auto [s, eps] = eve::quick_two_sub(pf, qf); | ||
std::cout << "---- simd" << '\n' | ||
<< " <- pf = " << pf << '\n' | ||
<< " <- qf = " << qf << '\n' | ||
<< " -> {s, eps] = quick_two_sub(pf, qf)\n" | ||
<< " -> s = " << s << '\n' | ||
<< " -> eps = " << eps << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
using wide_it = eve::wide<float, eve::fixed<4>>; | ||
|
||
int main() | ||
{ | ||
wide_it pf = {0, 1, -1, -eve::valmax(eve::as<float>())/10}; | ||
wide_it qf = {1, -1, 0, eve::valmax(eve::as<float>())/10}; | ||
|
||
std::cout << "---- simd" << '\n' | ||
<< "<- pf = " << pf << '\n' | ||
<< "<- qf = " << qf << '\n' | ||
<< "-> reldist(pf, qf) = " << eve::reldist(pf, qf) << '\n'; | ||
|
||
float xf = -eve::valmax(eve::as<float>())/10; | ||
float yf = eve::valmax(eve::as<float>())/10; | ||
|
||
std::cout << "---- scalar" << '\n' | ||
<< "<- xf = " << xf << '\n' | ||
<< "<- yf = " << yf << '\n' | ||
<< "-> reldist(xf, yf) = " << eve::reldist(xf, yf) << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
using wf_t = eve::wide<float, eve::fixed<4>>; | ||
wf_t pf = {3, 2.5, -32.7, 1.0}, qf = {4.2, 1.5, -100.834, eve::eps(eve::as<float>())/2}; | ||
auto [s, eps] = eve::two_add(pf, qf); | ||
std::cout << "---- simd" << '\n' | ||
<< " <- pf = " << pf << '\n' | ||
<< " <- qf = " << qf << '\n' | ||
<< " -> {s, eps] = two_add(pf, qf)\n" | ||
<< " -> s = " << s << '\n' | ||
<< " -> eps = " << eps << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
using wf_t = eve::wide<float, eve::fixed<4>>; | ||
wf_t pf = {3, 2.5, -32.7, 1.0}, qf = {4.2, 1.5, -100.834, eve::eps(eve::as<float>())/2}; | ||
auto [s, eps] = eve::two_prod(pf, qf); | ||
std::cout << "---- simd" << '\n' | ||
<< " <- pf = " << pf << '\n' | ||
<< " <- qf = " << qf << '\n' | ||
<< " -> {s, eps] = two_prod(pf, qf)\n" | ||
<< " -> s = " << s << '\n' | ||
<< " -> eps = " << eps << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
using wf_t = eve::wide<float, eve::fixed<4>>; | ||
wf_t pf = {3, 2.5, -32.7, eve::eps(eve::as<float>())}; | ||
auto [s, eps] = eve::two_sqr(pf); | ||
std::cout << "---- simd" << '\n' | ||
<< " <- pf = " << pf << '\n' | ||
<< " -> {s, eps] = two_sqr(pf)\n" | ||
<< " -> s = " << s << '\n' | ||
<< " -> eps = " << eps << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <eve/module/core.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
using wf_t = eve::wide<float, eve::fixed<4>>; | ||
wf_t pf = {6, 2.5, -320.7, 1.0}, qf = {4.2, 1.5, -100.834, eve::eps(eve::as<float>())/2}; | ||
auto [s, eps] = eve::two_sub(pf, qf); | ||
std::cout << "---- simd" << '\n' | ||
<< " <- pf = " << pf << '\n' | ||
<< " <- qf = " << qf << '\n' | ||
<< " -> {s, eps] = two_sub(pf, qf)\n" | ||
<< " -> s = " << s << '\n' | ||
<< " -> eps = " << eps << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <eve/module/math.hpp> | ||
#include <eve/wide.hpp> | ||
#include <iostream> | ||
#include <iomanip> | ||
|
||
using wide_ft = eve::wide<float>; | ||
using wide_dt = eve::wide<double>; | ||
|
||
int main() | ||
{ | ||
wide_ft wxf; | ||
wide_dt wxd; | ||
|
||
std::cout << "---- simd" << std::setprecision(9) << std::endl | ||
<< "-> quarter(as<wide_ft>()) = " << eve::quarter(eve::as<wide_ft>()) << std::endl | ||
<< "-> quarter(as(wxf)) = " << eve::quarter(eve::as(wxf)) << std::endl | ||
<< "-> upward(quarter)(as<wide_ft>()) = " << eve::upward(eve::quarter)(eve::as<wide_ft>()) << std::endl | ||
<< "-> upward(quarter)(as(wxf)) = " << eve::upward(eve::quarter)(eve::as(wxf)) << std::endl | ||
<< "-> downward(quarter)(as<wide_ft>()) = " << eve::downward(eve::quarter)(eve::as<wide_ft>()) << std::endl | ||
<< "-> downward(quarter)(as(wxf)) = " << eve::downward(eve::quarter)(eve::as(wxf)) << std::endl | ||
<< std::setprecision(17) | ||
<< "-> quarter(as<wide_dt>()) = " << eve::quarter(eve::as<wide_dt>()) << std::endl | ||
<< "-> quarter(as(wxd)) = " << eve::quarter(eve::as(wxd)) << std::endl | ||
<< "-> upward(quarter)(as<wide_dt>()) = " << eve::upward(eve::quarter)(eve::as<wide_dt>()) << std::endl | ||
<< "-> upward(quarter)(as(wxd)) = " << eve::upward(eve::quarter)(eve::as(wxd)) << std::endl | ||
<< "-> downward(quarter)(as<wide_dt>()) = " << eve::downward(eve::quarter)(eve::as<wide_dt>()) << std::endl | ||
<< "-> downward(quarter)(as(wxd)) = " << eve::downward(eve::quarter)(eve::as(wxd)) << std::endl; | ||
|
||
float xf; | ||
double xd; | ||
|
||
std::cout << "---- scalar" << std::endl | ||
<< "-> quarter(as<float>()) = " << eve::quarter(eve::as(float())) << std::endl | ||
<< "-> quarter(as<xf)) = " << eve::quarter(eve::as(xf)) << std::endl | ||
<< "-> quarter(as<double>()) = " << eve::quarter(eve::as(double()))<< std::endl | ||
<< "-> quarter(as<xd)) = " << eve::quarter(eve::as(xd)) << std::endl; | ||
|
||
return 0; | ||
} |