Skip to content
Snippets Groups Projects

Distinguish between SymPy and pystencils Assignement better

Merged Markus Holzer requested to merge holzer/pystencils:Sum into master
All threads resolved!
1 file
+ 10
9
Compare changes
  • Side-by-side
  • Inline
@@ -262,19 +262,20 @@ class CBackend:
return f"{prefix}{loop_str}\n{self._print(node.body)}"
def _print_SympyAssignment(self, node):
printed_lhs = self.sympy_printer.doprint(node.lhs)
printed_rhs = self.sympy_printer.doprint(node.rhs)
binop = node.binop
if node.is_declaration:
if node.use_auto:
data_type = 'auto '
data_type = 'auto'
else:
data_type = self._print(node.lhs.dtype).replace(' const', '')
if node.is_const:
prefix = 'const '
data_type = f'const {data_type}'
else:
prefix = ''
data_type = prefix + self._print(node.lhs.dtype).replace(' const', '') + " "
return "%s%s %s= %s;" % (data_type, node.binop,
self.sympy_printer.doprint(node.lhs),
self.sympy_printer.doprint(node.rhs))
data_type = f'{data_type}'
return f"{data_type} {printed_lhs} {binop}= {printed_rhs};"
else:
lhs_type = get_type_of_expression(node.lhs) # TOOD: this should have been typed
printed_mask = ""
@@ -350,7 +351,7 @@ class CBackend:
code += f"\nif ({flushcond}) {{\n\t{code2}\n}} else {{\n\t{code1}\n}}"
return pre_code + code
else:
return f"{self.sympy_printer.doprint(node.lhs)} {node.binop}= {self.sympy_printer.doprint(node.rhs)};"
return f"{printed_lhs} {binop}= {printed_rhs};"
def _print_NontemporalFence(self, _):
if 'streamFence' in self._vector_instruction_set:
Loading