Fix test hip_bitextract.cpp (#1784)

The randomly generated offset+width may exceeds 32, which causes
a left shift operation with 32-offset-width. As an unsigned number
that is greater than 32 and causes undefined behavior. When the
test is compiled without -mavx it is still OK. However when
the test is compiled with -mavx, the undefined behavior causes
wrong results and test failure.

This patch adjusts width so that offset+width<=32 always.
Bu işleme şunda yer alıyor:
Yaxun (Sam) Liu
2020-01-10 03:16:57 -05:00
işlemeyi yapan: Maneesh Gupta
ebeveyn c091635f5a
işleme 55525fa466
+2
Dosyayı Görüntüle
@@ -123,6 +123,8 @@ int main() {
hostSrc032[i] = uint32_src0_dist(rd);
hostSrc132[i] = uint32_src12_dist(rd);
hostSrc232[i] = uint32_src12_dist(rd);
if (hostSrc132[i] + hostSrc232[i] > 32)
hostSrc232[i] = 32 - hostSrc132[i];
hostOut64[i] = 0;
hostSrc064[i] = uint64_src0_dist(rd);
hostSrc164[i] = uint64_src12_dist(rd);