codegen for full reduction
code gen for generic reduction functions (test passed)