Adding direct loop code generation and global reductions