Skip to content

Commit

Permalink
I think the first operand of shl should be unsigned
Browse files Browse the repository at this point in the history
Addresses #642.
  • Loading branch information
PeiMu committed Mar 2, 2023
1 parent 77e9b64 commit 7ae52ca
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 21 deletions.
46 changes: 46 additions & 0 deletions analysis/statistics/bf8512d6a1a6fa55b61748bf00fbda41c3648b38.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

changeset: 1434:bf8512d6a1a6fa55b61748bf00fbda41c3648b38
char kNewtonVersion[] = "0.3-alpha-1434 (bf8512d6a1a6fa55b61748bf00fbda41c3648b38) (build 03-02-2023-15:[email protected]_64)";
\n./src/noisy/noisy-linux-EN -O0 applications/noisy/helloWorld.n -s
\n./src/newton/newton-linux-EN -v 0 -eP applications/newton/invariants/ViolinWithTemperatureDependence-pigroups.nt

Informational Report:
---------------------
Invariant "ViolinWithTemperatureDependenceForPiGroups" has 2 unique kernels, each with 2 column(s)...

Kernel 0 is a valid kernel:

1 1
-0.5 -0
1 0
0.5 0
0 -1
-0 -1


The ordering of parameters is: P1 P0 P3 P2 P4 P5

Pi group 0, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^( 0) P5^(-0)

Pi group 0, Pi 1 is: P0^(-0) P1^( 1) P2^( 0) P3^( 0) P4^(-1) P5^(-1)


Kernel 1 is a valid kernel:

1 0
-0.5 1
1 -2
0.5 -1
-0 -2
0 -2


The ordering of parameters is: P1 P0 P3 P2 P4 P5

Pi group 1, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^(-0) P5^( 0)

Pi group 1, Pi 1 is: P0^( 1) P1^( 0) P2^(-1) P3^(-2) P4^(-2) P5^(-2)




6 changes: 3 additions & 3 deletions applications/newton/llvm-ir/performance_test/auto_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ struct timerData recordTimerData(const std::string& test_cases, const std::strin
std::back_inserter(timer_data.function_results),
[test_cases, param_str, timer_data, data_timer_res](double val) {
if (!timer_data.function_results.empty()) {
// if (!std::equal(timer_data.function_results.begin(), timer_data.function_results.end(),
// data_timer_res.second.begin()))
// std::cerr << "result error: " << test_cases << " with parameters: " << param_str << std::endl;
if (!std::equal(timer_data.function_results.begin(), timer_data.function_results.end(),
data_timer_res.second.begin()))
std::cerr << "result error within iteration: " << test_cases << " with parameters: " << param_str << std::endl;
return false;
} else
return true;
Expand Down
34 changes: 16 additions & 18 deletions src/newton/newton-irPass-LLVMIR-rangeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,8 +967,6 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
if (auto llvmIrCallInstruction = dyn_cast<CallInst>(&llvmIrInstruction))
{
Function * calledFunction = llvmIrCallInstruction->getCalledFunction();
if (calledFunction->getName().startswith("normalizeFloat64Subnormal"))
int a = 0;
if (calledFunction == nullptr || !calledFunction->hasName() || calledFunction->getName().empty())
break;
if (calledFunction->getName().startswith("llvm.dbg.value") ||
Expand Down Expand Up @@ -1988,20 +1986,20 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
switch (bitWidth)
{
case 8:
lowerBound = static_cast<double>(static_cast<int8_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<int8_t>(vrRangeIt->second.second));
lowerBound = static_cast<double>(static_cast<uint8_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<uint8_t>(vrRangeIt->second.second));
break;
case 16:
lowerBound = static_cast<double>(static_cast<int16_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<int16_t>(vrRangeIt->second.second));
lowerBound = static_cast<double>(static_cast<uint16_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<uint16_t>(vrRangeIt->second.second));
break;
case 32:
lowerBound = static_cast<double>(static_cast<int32_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<int32_t>(vrRangeIt->second.second));
lowerBound = static_cast<double>(static_cast<uint32_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<uint32_t>(vrRangeIt->second.second));
break;
case 64:
lowerBound = static_cast<double>(static_cast<int64_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<int64_t>(vrRangeIt->second.second));
lowerBound = static_cast<double>(static_cast<uint64_t>(vrRangeIt->second.first));
upperBound = static_cast<double>(static_cast<uint64_t>(vrRangeIt->second.second));
break;
default:
assert(false);
Expand All @@ -2019,14 +2017,14 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
auto leftMax = upperBound;
double rightMin = vrRangeIt->second.first;
double rightMax = vrRangeIt->second.second;
lowerBound = min(min(min((int64_t)leftMin << (int64_t)rightMin,
(int64_t)leftMin << (int64_t)rightMax),
(int64_t)leftMax << (int64_t)rightMin),
(int64_t)leftMax << (int64_t)rightMax);
upperBound = max(max(max((int64_t)leftMin << (int64_t)rightMin,
(int64_t)leftMin << (int64_t)rightMax),
(int64_t)leftMax << (int64_t)rightMin),
(int64_t)leftMax << (int64_t)rightMax);
lowerBound = min(min(min((uint64_t)leftMin << (int64_t)rightMin,
(uint64_t)leftMin << (int64_t)rightMax),
(uint64_t)leftMax << (int64_t)rightMin),
(uint64_t)leftMax << (int64_t)rightMax);
upperBound = max(max(max((uint64_t)leftMin << (int64_t)rightMin,
(uint64_t)leftMin << (int64_t)rightMax),
(uint64_t)leftMax << (int64_t)rightMin),
(uint64_t)leftMax << (int64_t)rightMax);
}
else
{
Expand Down

0 comments on commit 7ae52ca

Please sign in to comment.