Skip to content

Commit

Permalink
test with/without bitwise/modulo op
Browse files Browse the repository at this point in the history
Addresses #647.
  • Loading branch information
PeiMu committed Apr 26, 2023
1 parent 3c4cf38 commit 3fadcae
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
46 changes: 46 additions & 0 deletions analysis/statistics/8e40c03f96f8a2646b258ee1f565a40b2c1a468f.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

changeset: 1479:8e40c03f96f8a2646b258ee1f565a40b2c1a468f
char kNewtonVersion[] = "0.3-alpha-1479 (8e40c03f96f8a2646b258ee1f565a40b2c1a468f) (build 04-20-2023-12:[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)




11 changes: 11 additions & 0 deletions src/newton/newton-irPass-LLVMIR-rangeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

#include "newton-irPass-LLVMIR-rangeAnalysis.h"

#define DISABLE_BITWISE_OP 0
#define DISABLE_MODULO_OP 0

using namespace llvm;

extern "C" {
Expand Down Expand Up @@ -1875,6 +1878,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
case Instruction::URem:
case Instruction::SRem:
case Instruction::FRem:
#ifndef DISABLE_MODULO_OP
if (auto llvmIrBinaryOperator = dyn_cast<BinaryOperator>(&llvmIrInstruction))
{
Value * leftOperand = llvmIrInstruction.getOperand(0);
Expand Down Expand Up @@ -1953,6 +1957,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
assert(!valueRangeDebug && "failed to get range");
}
}
#endif
break;

case Instruction::Shl:
Expand Down Expand Up @@ -2537,6 +2542,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
break;

case Instruction::And:
#ifndef DISABLE_BITWISE_OP
if (auto llvmIrBinaryOperator = dyn_cast<BinaryOperator>(&llvmIrInstruction))
{
Value * leftOperand = llvmIrInstruction.getOperand(0);
Expand Down Expand Up @@ -2622,9 +2628,11 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
assert(!valueRangeDebug && "failed to get range");
}
}
#endif
break;

case Instruction::Or:
#ifndef DISABLE_BITWISE_OP
if (auto llvmIrBinaryOperator = dyn_cast<BinaryOperator>(&llvmIrInstruction))
{
Value * leftOperand = llvmIrInstruction.getOperand(0);
Expand Down Expand Up @@ -2710,9 +2718,11 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
assert(!valueRangeDebug && "failed to get range");
}
}
#endif
break;

case Instruction::Xor:
#ifndef DISABLE_BITWISE_OP
if (auto llvmIrBinaryOperator = dyn_cast<BinaryOperator>(&llvmIrInstruction))
{
Value * leftOperand = llvmIrInstruction.getOperand(0);
Expand Down Expand Up @@ -2798,6 +2808,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo,
assert(!valueRangeDebug && "failed to get range");
}
}
#endif
break;

case Instruction::FPToUI:
Expand Down
2 changes: 1 addition & 1 deletion src/newton/newton-irPass-LLVMIR-shrinkTypeByRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/*
* this macro can also move to the compiler config
* */
#define UNSIGNED_SHRINK 0
#define UNSIGNED_SHRINK 1

using namespace llvm;

Expand Down

0 comments on commit 3fadcae

Please sign in to comment.