|
| 1 | +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out |
| 2 | +// RUNx: %CPU_RUN_PLACEHOLDER %t.out |
| 3 | +// RUNx: %GPU_RUN_PLACEHOLDER %t.out |
| 4 | +// RUNx: %ACC_RUN_PLACEHOLDER %t.out |
| 5 | + |
| 6 | +#include <sycl/sycl.hpp> |
| 7 | + |
| 8 | +int main() { |
| 9 | + sycl::queue testQueue; |
| 10 | + |
| 11 | + { |
| 12 | + const sycl::longlong3 verification3( |
| 13 | + 9223372036854775807LL, 9223372036854775807LL, -9223372036854775808LL); |
| 14 | + |
| 15 | + sycl::longlong3 inputData_0(1152105081885725616LL, 8383539663869980295LL, |
| 16 | + -3013159033463244495LL); |
| 17 | + sycl::longlong3 inputData_1(9169239286331099647LL, 8545168655265359544LL, |
| 18 | + 69290337040907021LL); |
| 19 | + sycl::longlong3 inputData_2(-5670250901301018333LL, 216462155376518854LL, |
| 20 | + -7910909987096217335LL); |
| 21 | + |
| 22 | + sycl::buffer<sycl::longlong3, 1> buffer(1); |
| 23 | + |
| 24 | + testQueue.submit([&](sycl::handler &h) { |
| 25 | + auto resultPtr = buffer.template get_access<sycl::access::mode::write>(h); |
| 26 | + h.single_task<class k3>([=]() { |
| 27 | + resultPtr[0] = sycl::mad_sat(inputData_0, inputData_1, inputData_2); |
| 28 | + }); |
| 29 | + }); |
| 30 | + const auto HostAccessor = buffer.get_access<sycl::access::mode::read>(); |
| 31 | + for (int i = 0; i < 3; i++) |
| 32 | + assert((HostAccessor[0][i] == verification3[i]) && "Incorrect result"); |
| 33 | + } |
| 34 | + { |
| 35 | + const sycl::longlong4 verification4( |
| 36 | + 9223372036854775807LL, 9223372036854775807LL, -9223372036854775808LL, |
| 37 | + 9223372036854775807LL); |
| 38 | + |
| 39 | + sycl::longlong4 inputData_0(-4713774672458165250LL, 7161321293740295698LL, |
| 40 | + -7560042360032818022LL, 1712118953348815386LL); |
| 41 | + sycl::longlong4 inputData_1(-5256951628950351348LL, 3094294642897896981LL, |
| 42 | + 4183324171724765944LL, 1726930751531248453LL); |
| 43 | + sycl::longlong4 inputData_2(-614349234816759997LL, -7793620271163345724LL, |
| 44 | + 5480991826433743823LL, -3977840325478979484LL); |
| 45 | + |
| 46 | + sycl::buffer<sycl::longlong4, 1> buffer(1); |
| 47 | + |
| 48 | + testQueue.submit([&](sycl::handler &h) { |
| 49 | + auto resultPtr = buffer.template get_access<sycl::access::mode::write>(h); |
| 50 | + h.single_task<class k4>([=]() { |
| 51 | + resultPtr[0] = sycl::mad_sat(inputData_0, inputData_1, inputData_2); |
| 52 | + }); |
| 53 | + }); |
| 54 | + const auto HostAccessor = buffer.get_access<sycl::access::mode::read>(); |
| 55 | + for (int i = 0; i < 4; i++) |
| 56 | + assert((HostAccessor[0][i] == verification4[i]) && "Incorrect result"); |
| 57 | + } |
| 58 | + { |
| 59 | + const sycl::longlong8 verification8( |
| 60 | + 9223372036854775807LL, 9223372036854775807LL, -9223372036854775808LL, |
| 61 | + -9223372036854775808LL, 9223372036854775807LL, 9223372036854775807LL, |
| 62 | + -9223372036854775808LL, -9223372036854775808LL); |
| 63 | + |
| 64 | + sycl::longlong8 inputData_0(3002837817109371705LL, -6132505093056073745LL, |
| 65 | + -2677806413031023542LL, -3906932152445696896LL, |
| 66 | + -5966911996430888011LL, 487233493241732294LL, |
| 67 | + 8234534527416862935LL, 8302379558520488989LL); |
| 68 | + sycl::longlong8 inputData_1(3895748400226584336LL, -3171989754828069475LL, |
| 69 | + 6135091761884568657LL, 3449810579449494485LL, |
| 70 | + -5153085649597103327LL, 2036067225828737775LL, |
| 71 | + -2456339276147680058LL, -2321401317481120691LL); |
| 72 | + sycl::longlong8 inputData_2(5847800471474896191LL, 6421268696360310080LL, |
| 73 | + 426131359031594004LL, 3388848179800138438LL, |
| 74 | + 9095634920776267157LL, 3909069092545608647LL, |
| 75 | + -6551917618131929798LL, -5283018165188606431LL); |
| 76 | + |
| 77 | + sycl::buffer<sycl::longlong8, 1> buffer(1); |
| 78 | + |
| 79 | + testQueue.submit([&](sycl::handler &h) { |
| 80 | + auto resultPtr = buffer.template get_access<sycl::access::mode::write>(h); |
| 81 | + h.single_task<class k8>([=]() { |
| 82 | + resultPtr[0] = sycl::mad_sat(inputData_0, inputData_1, inputData_2); |
| 83 | + }); |
| 84 | + }); |
| 85 | + const auto HostAccessor = buffer.get_access<sycl::access::mode::read>(); |
| 86 | + for (int i = 0; i < 8; i++) |
| 87 | + assert((HostAccessor[0][i] == verification8[i]) && "Incorrect result"); |
| 88 | + } |
| 89 | + { |
| 90 | + const sycl::longlong16 verification16( |
| 91 | + -9223372036854775808LL, 9223372036854775807LL, 9223372036854775807LL, |
| 92 | + -9223372036854775808LL, 9223372036854775807LL, 9223372036854775807LL, |
| 93 | + 9223372036854775807LL, 9223372036854775807LL, 9223372036854775807LL, |
| 94 | + 9223372036854775807LL, -9223372036854775808LL, 9223372036854775807LL, |
| 95 | + -9223372036854775808LL, 9223372036854775807LL, -9223372036854775808LL, |
| 96 | + -9223372036854775808LL); |
| 97 | + |
| 98 | + sycl::longlong16 inputData_0( |
| 99 | + 4711072418277000515LL, -8205098172692021203LL, -7385016145788992368LL, |
| 100 | + 5953521028589173909LL, -5219240995491769312LL, 8710496141913755416LL, |
| 101 | + -6685846261491268433LL, 4193173269411595542LL, -8540195959022520771LL, |
| 102 | + -4715465363106336895LL, -1020086937442724783LL, 4496316677230042947LL, |
| 103 | + 1321442475247578017LL, -7374746170855359764LL, -3206370806055241163LL, |
| 104 | + -2175226063524462053LL); |
| 105 | + sycl::longlong16 inputData_1( |
| 106 | + -9126728881985856159LL, -8235441378758843293LL, -3529617622861997052LL, |
| 107 | + -4696495345590499183LL, -2446014787831249326LL, 3966377959819902357LL, |
| 108 | + -8707315735766590681LL, 4940281453308003965LL, -4008494233289413829LL, |
| 109 | + -1007875458987895243LL, 8007184939842565626LL, 7006363475270750393LL, |
| 110 | + -3126435375497361798LL, -2666957213164527889LL, 3425215156535282625LL, |
| 111 | + 5057359883753713949LL); |
| 112 | + sycl::longlong16 inputData_2( |
| 113 | + -5792361016316836568LL, 1155364222481085809LL, 7552404711758320408LL, |
| 114 | + -9123476257323872288LL, -924920183965907175LL, 1921314238201973170LL, |
| 115 | + 3462681782260196063LL, 7822120358287768333LL, -3130033938219713817LL, |
| 116 | + -3165995450630991604LL, -7647706888277832178LL, -8427901934971949821LL, |
| 117 | + 4207763935319579681LL, 1564279736903158695LL, 3722632463806041635LL, |
| 118 | + 939009161285897285LL); |
| 119 | + |
| 120 | + sycl::buffer<sycl::longlong16, 1> buffer(1); |
| 121 | + |
| 122 | + testQueue.submit([&](sycl::handler &h) { |
| 123 | + auto resultPtr = buffer.template get_access<sycl::access::mode::write>(h); |
| 124 | + |
| 125 | + h.single_task<class k16>([=]() { |
| 126 | + resultPtr[0] = sycl::mad_sat(inputData_0, inputData_1, inputData_2); |
| 127 | + }); |
| 128 | + }); |
| 129 | + const auto HostAccessor = buffer.get_access<sycl::access::mode::read>(); |
| 130 | + for (int i = 0; i < 16; i++) |
| 131 | + assert((HostAccessor[0][i] == verification16[i]) && "Incorrect result"); |
| 132 | + } |
| 133 | +} |
0 commit comments